watch(props, () => {
if (!props.restaurantId) return;
/**
* @type { {
canCount: 0,
curCount: 0,
list: []
}}
*/
const e = cartStore.getSelectGroupInfo({ restaurantId: props.restaurantId, categoryId: props.category.Id, typeList:props.category.ComboList })
// console.log("e", e)
entry.value = {
curCount: e.curCount,
canCount: e.canCount,
listStr: e.list.map(l => l.Name).join(",")
}
}, {
deep:true,
immediate: true,
})
- 发布:2024-05-10 12:32
- 更新:2024-05-10 12:32
- 阅读:232
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10 22H2
HBuilderX类型: 正式
HBuilderX版本号: 4.15
第三方开发者工具版本号: 1.06
基础库版本号: 3.43
项目创建方式: HBuilderX
操作步骤:
预期结果:
watch(props, () => {
if (!props.restaurantId) return;
/**
* @type { {
canCount: 0,
curCount: 0,
list: []
}}
*/
const e = cartStore.getSelectGroupInfo({ restaurantId: props.restaurantId, categoryId: props.category.Id, typeList:props.category.ComboList })
// console.log("e", e)
entry.value = {
curCount: e.curCount,
canCount: e.canCount,
listStr: e.list.map(l => l.Name).join(",")
}
}, {
deep:true,
immediate: true,
})
watch(props, () => {
if (!props.restaurantId) return;
/**
* @type { {
canCount: 0,
curCount: 0,
list: []
}}
*/
const e = cartStore.getSelectGroupInfo({ restaurantId: props.restaurantId, categoryId: props.category.Id, typeList:props.category.ComboList })
// console.log("e", e)
entry.value = {
curCount: e.curCount,
canCount: e.canCount,
listStr: e.list.map(l => l.Name).join(",")
}
}, {
deep:true,
immediate: true,
})
实际结果:
watch(props, () => {
if (!props.restaurantId) return;
/**
* @type { {
canCount: 0,
curCount: 0,
list: []
}}
*/
const e = cartStore.getSelectGroupInfo({ restaurantId: props.restaurantId, categoryId: props.category.Id, typeList:props.category.ComboList })
// console.log("e", e)
entry.value = {
curCount: e.curCount,
canCount: e.canCount,
listStr: e.list.map(l => l.Name).join(",")
}
}, {
deep:true,
immediate: true,
})
watch(props, () => {
if (!props.restaurantId) return;
/**
* @type { {
canCount: 0,
curCount: 0,
list: []
}}
*/
const e = cartStore.getSelectGroupInfo({ restaurantId: props.restaurantId, categoryId: props.category.Id, typeList:props.category.ComboList })
// console.log("e", e)
entry.value = {
curCount: e.curCount,
canCount: e.canCount,
listStr: e.list.map(l => l.Name).join(",")
}
}, {
deep:true,
immediate: true,
})
bug描述:
使用watch函数仅执行一次,但是旧版本是正常的,近两天HBuilderX工具提示更新最新版本,更新之后发现watch失效,变量变化不触发更新 使用的vue3 场景是一个购物车,选择商品之后的监听
0 个回复