this.$watch(),this.$set(),this.$nextTick()=>{})


///組件生命周期 掛載到html文檔中
//this.$watch可以下載mounted和update這種但是不能在methods中
mounted () {
this.$watch('value.show',newValue=>{
if (newValue){
this.value.formData.learnPlanId = this.value.formData.id;
delete this.value.formData.id;
this.reset = false;
this.$nextTick(()=>{
this.reset = true;
});
}else {
this.value.formData = {};
}
})
},


///這種主要用於當對象中某個屬性值動態生成時處理方式this.$se()會在事件的下一次空閑時間執行,不知道什么時候執行但是一定會執行
const t = Number(this.value.formData.inTotal);
this.selectedQuestion.questionCount = t;
this.$set(this.selectedQuestion, 'questionCount', t);

///$nextTick 是在下次 DOM 更新循環結束之后執行延遲回調
 this.$nextTick(()=>{
this.reset = true;
});


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM