子组件调用父组件方法带参数
子组件调用父组件方法带参数
- 父组件
### template
<DBTableSelect ref="DBTableEdit" @customEvent="handleCustomEvent" @close="closedDrawDBTable"
v-if="showDrawDBTable"/>
### js
import DBTableSelect from "./DBTableSelect.vue";
name: "tableRelation",
components: {DBTableSelect},
handleCustomEvent(data){
console.log('接收到的信息: ',data)
}
- 子组件
let obj = {fieldsData: this.tableFieldArr,tableNames: this.tableList,databaseUnid: this.databaseUnid}
this.$emit('customEvent', obj)
- 参数可以为数组、对象、单个参数
本文来自博客园,作者:ElloeStudy,转载请注明原文链接:https://www.cnblogs.com/ElloeStudy/p/17604058.html