From 3af247febb58d0a042c6735c56fd8b7d5c445fe8 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Mon, 8 Apr 2024 14:25:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(playground):=20=E7=94=BB=E5=B8=83=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8=E5=88=87=E6=8D=A2=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于element-plus2.6后radio-button label属性改成value fix #586 --- playground/src/components/DeviceGroup.vue | 35 +++++++++-------------- playground/src/pages/Editor.vue | 10 ++----- 2 files changed, 16 insertions(+), 29 deletions(-) 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 @@ - +