問題描述this.$nextTick()是在數據完成更新后立即獲取數據,但是我使用nextTick沒有生效,獲取的數據還是更新前的。相關代碼首頁會員訂單查找components:{},data(){return{selected:"home"};},methods:{changeHash(){console.log('之前',this.selected);//在數據完成更新后發生的行為this.$nextTick(function(){console.log('之后',this.selected);});}},watch:{//selected(newVal){//this.$router.push({//name:newVal//});//}}你期待的結果是什么?實際看到的錯誤信息又是什么?我想看到當點擊不同的tab前后數據會發生變化,而不是下面這種情況。之前home之后home之前member之后member之前shopcart之后shopcart
大佬們遇到過這個問題嗎?vue 中 this.$nextTick() 不生效的問題
神不在的星期二
2019-08-11 13:59:06