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