父组件
<el-form ref="dataForm" :rules="rules" :model="form" label-width="100px"> <el-form-item label="选择上级" prop="superior"> <!-- v-if="textMap[dialogStatus] =='新增'" --> <el-input v-model="form.superior" @focus="handleSelect" placeholder="请输入内容"></el-input> </el-form-item> <el-form-item :label="typeRowName + '名称'" prop="fondsName"> <el-input :placeholder="'请选择' + typeRowName + '名称'" v-model="form.fondsName" class="input-with-select"> <el-input v-model="form.fondsName" @focus="handleSelect" placeholder="请输入内容"></el-input> </el-input> </el-form-item> </el-form> <select-user :user-config="userConfig" @submit="handleSubmit"></select-user> <script> import selectDepartmentTree from './components/selectDepartmentTree' export default { data(){ form: { superior:'', fondsName: '' }, rules: { superior:[{ required: true, message: '不能为空', trigger: 'change' }], fondsName: [ { required: true, message: '名称不能为空!', trigger: 'blur' }, { min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' } ], }, userConfig:{ visible:false }, }, components:{ selectDepartmentTree }, method:{ handleSelect(){ this.userConfig.visible = false }, handleSubmit(val){ this.$set("form",“superior”,val) } } } </script> 子组件 <template> <buttom @click="add">添加</buttom> </template> <script> export default{ method:{ add(){ this.$emit("handleSubmit", 靓仔) } } } </script>