出现问题
TypeError: Cannot read properties of undefined (reading 'init_params')
<test1 :is="currentComp" :ref="currentComp"></test1>
jumpPage(){
if(this.currentComp=="business"){
this.$refs["business"].init_params(this.query);
}else if(this.currentComp=="plateCompose"){
this.$refs["plateCompose"].init_params(this.query);
}else this.$refs["economic"].init_params(this.query);
},
关于 ref 注册时间的重要说明:因为 ref 本身是作为渲染结果被创建的,在初始渲染的时候你不能访问
它们 - 它们还不存在!所以报错init_params未定义
解决方法: this.$nextTick(()=>{this.jumpPage();})