vue主页点击按钮如何调用子组件方法

  

<el-button type="primary" @click="openBtn">点击调用</el-button>
//添加ref
<ReportTraceQuery :reportTraceQueryShow.sync="reportTraceQueryShow" ref="reportTraceQuery"></ReportTraceQuery>
//调用
openMark() {
   this.$refs.reportTraceQuery.reportTraceQueryTableData();
   this.reportTraceQueryShow = true
},
//注:reportTraceQueryTableData()是子组件的方法
以上是编程学习网小编为您介绍的“vue主页点击按钮如何调用子组件方法”的全面内容,想了解更多关于 vuejs 内容,请继续关注编程基础学习网。

相关文章