diff --git a/playground/src/components/DeviceGroup.vue b/playground/src/components/DeviceGroup.vue index 2297691b..ebd1b317 100644 --- a/playground/src/components/DeviceGroup.vue +++ b/playground/src/components/DeviceGroup.vue @@ -1,8 +1,8 @@ @@ -34,22 +34,15 @@ const getDeviceHeight = (viewerDevice: DeviceType) => devH[viewerDevice]; const getDeviceWidth = (viewerDevice: DeviceType) => devW[viewerDevice]; -withDefaults( - defineProps<{ - modelValue: { - width: number; - height: number; - }; - }>(), - { - modelValue: () => ({ - width: 375, - height: 817, - }), - }, -); - -const emit = defineEmits(['update:modelValue']); +const modelValue = defineModel<{ + width: number | string; + height: number | string; +}>('modelValue', { + default: () => ({ + width: 375, + height: 817, + }), +}); const stageContainerRect = computed(() => services?.uiService.get('stageContainerRect')); @@ -81,10 +74,10 @@ const viewerDevice = ref(DeviceType.Phone); const deviceSelect = async (device: DeviceType) => { const width = getDeviceWidth(device); const height = getDeviceHeight(device); - emit('update:modelValue', { + modelValue.value = { width, height, - }); + }; await nextTick(); calcFontsize(); diff --git a/playground/src/pages/Editor.vue b/playground/src/pages/Editor.vue index d2f0565a..c3a19b10 100644 --- a/playground/src/pages/Editor.vue +++ b/playground/src/pages/Editor.vue @@ -24,19 +24,13 @@ - +