From 0ecc402885f332b21923bb12183dc072306f2b39 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期五, 21 三月 2025 18:36:15 +0800 Subject: [PATCH] vue3 --- components/oi-form/list/switch/index.vue | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/oi-form/list/switch/index.vue b/components/oi-form/list/switch/index.vue index 61be119..45adb7f 100644 --- a/components/oi-form/list/switch/index.vue +++ b/components/oi-form/list/switch/index.vue @@ -2,8 +2,8 @@ <view class="oi-form-switch"> <!-- Switch寮�叧 --> <switch v-if="model" :class="data.disabled?'input-disabled':''" :disabled="data.disabled" - v-model="model[data.fieldId]" @change="onChange" /> - <switch v-else :class="data.disabled?'input-disabled':''" :disabled="data.disabled" v-model="data.value" + :checked="model[data.fieldId]" @change="onChange" /> + <switch v-else :class="data.disabled?'input-disabled':''" :disabled="data.disabled" checked="data.value" @change="onChange" /> </view> </template> @@ -20,7 +20,11 @@ }, methods: { onChange(e) { - this.$emit("change", e) + this.data.value = e.detail.value + if (this.model) + this.model[this.data.fieldId] = e.detail.value + + this.$emit("on-change", e) }, -- Gitblit v1.9.1