1.在body里面添加按钮
代码语言:javascript
复制<a
title="字典项"
href="javascript:;"
v-funcode="'acl_sDict/dirSDict'"
@click="openNodeAndClick(data)"
> 字典项</a
>
2.在子页面methods里面为按钮添加方法:$emit将数据传到父页面
代码语言:javascript
复制 methods: {
openNodeAndClick(data) {
this.$emit('openNodeAndClick',data);
},
}
3.在父页面写一个方法绑定子页面方法@openNodeAndClick
代码语言:javascript
复制<component ref="DirSDict" :is="'DirSDict'" :params="params" @openNodeAndClick="openNodeAndClick"></component>
4.在父页面methods里面写方法
代码语言:javascript
复制methods: {
openNodeAndClick(data){
this.params.parentid = data.uuid
this.$refs.DirSDict.data.parentid = data.uuid;
// initialIndex
this.$refs.DirSDict.reset();
},
},