子组件调用父组件方法带参数
- 父组件
### 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)
- 参数可以为数组、对象、单个参数