在element-ui 中使用form表单中的input框,点击input框弹出一个对话框,将值传给form表单的input中,如果没有使用 this.$set("对象",“键”,

2021/9/13 6:06:38

本文主要是介绍在element-ui 中使用form表单中的input框,点击input框弹出一个对话框,将值传给form表单的input中,如果没有使用 this.$set("对象",“键”,,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

父组件 

 <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>

这篇关于在element-ui 中使用form表单中的input框,点击input框弹出一个对话框,将值传给form表单的input中,如果没有使用 this.$set("对象",“键”,的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程