mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 08:53:08 +02:00
63df2c851e
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
43 lines
1.2 KiB
Vue
43 lines
1.2 KiB
Vue
<template>
|
|
<MkContainer :show-header="widgetProps.showHeader" class="mkw-clicker">
|
|
<template #icon><i class="ti ti-cookie"></i></template>
|
|
<template #header>Clicker</template>
|
|
<MkClickerGame/>
|
|
</MkContainer>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
|
import { GetFormResultType } from '@/scripts/form';
|
|
import MkContainer from '@/components/MkContainer.vue';
|
|
import MkClickerGame from '@/components/MkClickerGame.vue';
|
|
|
|
const name = 'clicker';
|
|
|
|
const widgetPropsDef = {
|
|
showHeader: {
|
|
type: 'boolean' as const,
|
|
default: false,
|
|
},
|
|
};
|
|
|
|
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>
|