父级用this. r e f s 获 取 子 组 件 中 的 数 据 , 打 印 c o n s o l e . l o g ( t h i s . refs获取子组件中的数据,打印console.log(this. refsconsole.log(this.refs)有一个东西出现,但是console.log(this.$refs.name.functione()) undefine; 之前调用其他组件的时候并没有发现这样的问题。

原因:

	要在子组件挂载完成时this.$refs.name.functione()才可以生效

解决方式:

this.$nextTick(() => {
	this.$refs.name.functione()
})
Logo

前往低代码交流专区

更多推荐