vue.js中$watch的oldvalue与newValue

由于vue内部机制,导致对象或数组改变时旧值将与新值相同

vue.js文档中指出    详情>>

vueWatch

解决方案

一,this.$set 方法

二,Object.assign()方法

三,计算属性 computed

1
2
3
4
5
6
7
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
#
You forgot to set the qrcode for Alipay. Please set it in _config.yml.
You forgot to set the qrcode for Wechat. Please set it in _config.yml.
You forgot to set the business and currency_code for Paypal. Please set it in _config.yml.
You forgot to set the url Patreon. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×