//實(shí)例偵聽(tīng)簡(jiǎn)寫,score:被偵聽(tīng)的數(shù)據(jù)變量,function:偵聽(tīng)回調(diào)方法名
app.$watch('score',function(newValue,oldValue){
console.log("這是使用實(shí)例偵聽(tīng)");
console.log('新分?jǐn)?shù):'+newValue,'上次分?jǐn)?shù):'+oldValue);
})
//實(shí)例偵聽(tīng)完整寫法
app.$watch('score',{handler(newValue,oldValue){console.log(newValue,oldValue);},
immediate:true//強(qiáng)制立即偵聽(tīng)
})
承擔(dān)因您的行為而導(dǎo)致的法律責(zé)任,
本站有權(quán)保留或刪除有爭(zhēng)議評(píng)論。
參與本評(píng)論即表明您已經(jīng)閱讀并接受
上述條款。