调用其他组件里面的方法--随笔
A组件: import editMenuDialog from "./editMenuList" components:{"my-editMenuDialog":editMenuDialog} <div v-show="addMenuListShow"> <my-addMenuDialog ref="addDialogVisible" @refaddMenuList="refaddMenuList"></my-addMenuDialog> </div> data:{ return{ addMenuListShow : false } } method:{ custom(){ this.addMenuListShow = true; this.$refs.addDialogVisible.search(); }, refaddMenuList(){ this.search(); //B组件调用search方法 } }
B组件:
search(){ this.addDialog = true; } addForm(){ this.$emit("refaddMenuList") //调用A组件里面的search方法 }
本文来自博客园,作者:云霄紫潭,转载请注明原文链接:https://www.cnblogs.com/0520euv/p/12620721.html