当前位置:网站首页>watch 深度监听模式
watch 深度监听模式
2022-04-22 05:45:00 【Python User】
watch 的深度监听—监听更深层的一些数据。
如果是一个对象,则需要进行深度监控,才能监控到对象中属性的变化:
data(){
return{
form :{
name:'xxx',
age:12
}
}
}
watch:{
// 只监听一个对象
form(){
deep:true, // 开启深度监听
console.log(v.namge,v.age)
immediate:true
},
// 监听一个对象的某一个属性:
'form.a': {
handler(newName, oldName) {
console.log('obj.a changed');
},
immediate: true
}
}
immediate:true代表如果在 wacth 里声明了form之后,就会立即先去执行里面的handler方法,
deep:代表深度监控,监听form 和 他的属性。
handler:就是以前的监控处理函数。
通过v.name和v.age获取对象中具体的值。
版权声明
本文为[Python User]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_44684357/article/details/124329638
边栏推荐
猜你喜欢

关于常量指针、指针常量的使用--练习题(记录)

chorme调试工具

jeecgboot开发经验过程

IWDG

Ad embedded learning blue bridge

Error in QT: undefined reference to ` widget:: settime()‘

通用定时器

Access problems after setting up the local server

Setting time and date display of QT learning

Chapter 89 leetcode refers to offer dynamic programming (6) translating numbers into strings
随机推荐
opencv代码
高考志愿填报参考
STM32 learning note 3 - input pin of GPIO
常见面试问题 - 3(操作系统)
Opencv code
Can data frame, remote frame, error frame, and error reconnection
Record the pit of ad software learning
jeecgboot-online在线开发2
Jeecgboot Online form Development - control Configuration
STL函数库
指针所指的地址值及指针所指对象的值(学习笔记)
jeecgboot-online在线开发3
deep learning object detection
Heap basic operation source code Bing
Markdown 语法支持测试
QQueue使用介绍
Characteristics and usage of QT signal and slot
js等待异步执行完成后在执行
Chapter 89 leetcode refers to offer dynamic programming (6) translating numbers into strings
IWDG