問題描述this.$nextTick()是在數(shù)據(jù)完成更新后立即獲取數(shù)據(jù),但是我使用nextTick沒有生效,獲取的數(shù)據(jù)還是更新前的。相關(guān)代碼首頁會員訂單查找components:{},data(){return{selected:"home"};},methods:{changeHash(){console.log('之前',this.selected);//在數(shù)據(jù)完成更新后發(fā)生的行為this.$nextTick(function(){console.log('之后',this.selected);});}},watch:{//selected(newVal){//this.$router.push({//name:newVal//});//}}你期待的結(jié)果是什么?實(shí)際看到的錯誤信息又是什么?我想看到當(dāng)點(diǎn)擊不同的tab前后數(shù)據(jù)會發(fā)生變化,而不是下面這種情況。之前home之后home之前member之后member之前shopcart之后shopcart
vue 中 this.$nextTick() 的使用問題,我用的無效
蝴蝶不菲
2019-06-18 09:51:03