新增商品拼团模块
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="right" v-if="showSwitch">
|
||||
<u-switch :active-value="1" :inactive-value="0" v-model="isOpen" @change="defineEmits(['update:isOpen'])"></u-switch>
|
||||
<!-- 关键修复:删掉错误的 @change 绑定,defineModel 已自动处理双向绑定 -->
|
||||
<u-switch :active-value="1" :inactive-value="0" v-model="isOpen"></u-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -27,11 +28,12 @@ import { ref, onMounted, nextTick } from 'vue';
|
||||
const props = defineProps({
|
||||
options: {
|
||||
type: Object,
|
||||
default: {
|
||||
default: () => ({
|
||||
// 注意:对象/数组默认值推荐用函数,避免引用共享
|
||||
name: '标题',
|
||||
intro: '说明',
|
||||
icon: 'xszk'
|
||||
}
|
||||
})
|
||||
},
|
||||
showSwitch: {
|
||||
type: Boolean,
|
||||
@@ -41,11 +43,13 @@ const props = defineProps({
|
||||
|
||||
const headHeight = ref(70);
|
||||
|
||||
// defineModel 是 Vue3.4+ 语法糖,自动实现 v-model:isOpen 的双向绑定
|
||||
const isOpen = defineModel('isOpen', {
|
||||
type: [Boolean, String, Number],
|
||||
default: 0
|
||||
});
|
||||
|
||||
// 声明自定义 emit 事件(仅在 script setup 内使用)
|
||||
const emits = defineEmits(['load']);
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user