1、子组件
接受父组件传的值:
props: ['getInstCode','getDocCode']
data() { return { instCode:this.getInstCode, } },
调用父组件方法
this.$emit('change-type', '子组件数据');
2、父组件
<WsPreview v-if="instCode" :getInstCode="instCode" :getDocCode="docCode" @change-type="onChangeType"></WsPreview> import WsPreview from '@/components/WsPreview/index' components: { WsPreview }, onChangeType(name){ this.instCode='' console.log(name) //子组件传过来的数据 },