推荐 最新
栀子花爷爷

Vue Computed属性get、set不生效?

vue computed的get、set不生效,会是什么问题呢? export default { props: { endPoint: { type: Object } }, computed: { nativeEndPoint: { get() { console.log('-----获取--', this.endPoint) return { ...this.endPoint }; }, set(endPoint) { console.log('----------更新') } } } } 传入endPoint值:"width: 100, height: 100}" 如上图所示,当输入框修改值时,无法触发set()函数,实在奇怪,有没有大佬懂的

0
1
0
浏览量28
桃子爱吃玉米

vue, 计算属性如何赋值?

问个问题, vue computed不建议赋值, 因为computed是个只读对象, 但是computed不是有个set吗, 我现在在composition api, setup语法糖中想使用set并且给computed赋值该怎么做呢

0
1
0
浏览量25
六股小子

vue3中computed的如下使用方式是否有不妥?

使用的 "pinia" 按官方的说法,getter相当于computed 那么我这样用: const curr_data = computed(() => { return store[`curr_${props.name}_data`].children }) 是不是嵌套computed? 我这样写唯一的目的就是简化 template 中的代码,这样做有什么缺点吗? 谢谢。

0
1
0
浏览量19