mizzkey/packages/frontend/src/widgets/WidgetClicker.vue

46 lines
1.4 KiB
Vue
Raw Normal View History

2023-01-08 09:41:09 +01:00
<template>
<MkContainer :show-header="widgetProps.showHeader" class="mkw-clicker">
2023-01-15 00:30:29 +01:00
<template #icon><i class="ti ti-cookie"></i></template>
<template #header>Clicker</template>
2023-01-08 09:41:09 +01:00
<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,
2023-01-09 01:04:35 +01:00
default: false,
2023-01-08 09:41:09 +01:00
},
};
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>