mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-05 08:14:12 +09:00
feat(client): 🍪👈
This commit is contained in:
44
packages/frontend/src/widgets/clicker.vue
Normal file
44
packages/frontend/src/widgets/clicker.vue
Normal file
@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<MkContainer :show-header="widgetProps.showHeader" class="mkw-clicker">
|
||||
<template #header><i class="ti ti-cookie"></i>Clicker</template>
|
||||
<MkClickerGame/>
|
||||
</MkContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
||||
import { GetFormResultType } from '@/scripts/form';
|
||||
import { $i } from '@/account';
|
||||
import MkContainer from '@/components/MkContainer.vue';
|
||||
import MkClickerGame from '@/components/MkClickerGame.vue';
|
||||
|
||||
const name = 'clicker';
|
||||
|
||||
const widgetPropsDef = {
|
||||
showHeader: {
|
||||
type: 'boolean' as const,
|
||||
default: true,
|
||||
},
|
||||
};
|
||||
|
||||
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
||||
|
||||
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
||||
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
||||
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
||||
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
||||
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
||||
|
||||
const { widgetProps, configure } = useWidgetPropsManager(name,
|
||||
widgetPropsDef,
|
||||
props,
|
||||
emit,
|
||||
);
|
||||
|
||||
defineExpose<WidgetComponentExpose>({
|
||||
name,
|
||||
configure,
|
||||
id: props.widget ? props.widget.id : null,
|
||||
});
|
||||
</script>
|
@ -25,6 +25,7 @@ export default function(app: App) {
|
||||
app.component('MkwAiscriptApp', defineAsyncComponent(() => import('./aiscript-app.vue')));
|
||||
app.component('MkwAichan', defineAsyncComponent(() => import('./aichan.vue')));
|
||||
app.component('MkwUserList', defineAsyncComponent(() => import('./user-list.vue')));
|
||||
app.component('MkwClicker', defineAsyncComponent(() => import('./clicker.vue')));
|
||||
}
|
||||
|
||||
export const widgets = [
|
||||
@ -52,4 +53,5 @@ export const widgets = [
|
||||
'aiscriptApp',
|
||||
'aichan',
|
||||
'userList',
|
||||
'clicker',
|
||||
];
|
||||
|
Reference in New Issue
Block a user