From acf924dc8b12b91d11147d6e2ab2a66b97b285c7 Mon Sep 17 00:00:00 2001 From: fofolee Date: Fri, 24 Jan 2025 07:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20OptionEditor=20=E7=9A=84?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=92=8C=20modelValue=20=E7=9A=84?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/composer/common/OptionEditor.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/composer/common/OptionEditor.vue b/src/components/composer/common/OptionEditor.vue index 30ebb8d..4e5b58c 100644 --- a/src/components/composer/common/OptionEditor.vue +++ b/src/components/composer/common/OptionEditor.vue @@ -57,12 +57,13 @@ export default defineComponent({ }, computed: { localObject() { - return this.modelValue; + return this.modelValue || {}; }, }, methods: { updateOption(key, value) { - this.$emit("update:modelValue", { ...this.localObject, [key]: value }); + const newValue = { ...this.localObject, [key]: value }; + this.$emit("update:modelValue", newValue); }, getColumnStyle(width = 12) { if (width === "auto") { @@ -82,6 +83,12 @@ export default defineComponent({ return ["q-input", "q-select"].includes(config.component) && config.icon; }, }, + created() { + // Initialize with empty object if modelValue is null/undefined + if (!this.modelValue) { + this.$emit("update:modelValue", {}); + } + }, });