mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-22 02:15:11 +01:00
45 lines
1.3 KiB
Vue
45 lines
1.3 KiB
Vue
|
<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>
|