select 下拉框通过 @change 选择改变,轮巡方式根据id取name的值
<el-form-item label="企业类型" prop="entTypeId"> <el-select v-model="form.entTypeId" placeholder="请选择企业类型" style="width: 220px" @change="entTypeChange"> <el-option v-for="dict in exam_ent_type" :key="dict.value" :label="dict.label" :value="dict.value" ></el-option> </el-select> </el-form-item>
//select下拉框取lable值 const entTypeChange = (val:any) => { //获取select的方法 const itemObj= exam_ent_type.value.find((item:any)=>{ return item.value === val; }); console.log(itemObj); console.log(itemObj.label) form.value.areaName=itemObj.label; };
通过@node-click选中节点方式获取选中的值
<el-form-item label="所属地区" prop="areaId"> <el-tree-select v-model="form.areaId" :data="areaOptions" :props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择所属地区" check-strictly default-expand-all style="width: 220px" @node-click="handleAreaNodeClick" /> </el-form-item>
//area所属区域选中,取区域名称 const handleAreaNodeClick = (data: any) => { form.value.areaName=data.label; console.log(data.label) }
标签:el,tree,value,label,选中,itemObj,select From: https://www.cnblogs.com/wuzexin/p/17990529