vue官网的说明
data(){
return {
processSteps: {
type: 'form',
data: [
{
name: 'xiaoming',
age: 18
},{
name: 'xiaohong',
age: 18
}
]
},
list: []
}
}
//计算属性实现的监听也不是深度监听
computed: {
//processSteps为实例中实际用到的一个对象, 此处借助另一个变量newProcessSteps来完成监听后的处理操作
newProcessSetps(){
return JSON.parse(JSON.stringify(this.processSteps)))
},
//数组(只要有返回新数组就可以)
newList(){
return [...this.list] //...展开运算符返回一个新数组
}
},
watch: {
newProcessSteps:{
handler(newVal, oldVal){
console.log(newVal, oldVal)
//比较newVal和olcVal
...
...
},
deep: true
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。