当前位置: 首页 > 工具软件 > v-selectpage > 使用案例 >

<el-select>标签获取值、赋值

宋俊民
2023-12-01


一、html代码

<el-form-item label="比赛性别限制" label-width="120px">
      <el-select v-model="entity.matchGender">
           <el-option v-for="item in options"
                      :label="item.dicname"
                      :key="item.dicvalue"
                      :value="item.dicvalue" >
           </el-option>
       </el-select>
 </el-form-item>

二、获取值

$.get(dicUrlBase + "/page?pageNum=" + this.pageNum + "&pageSize=" + this.pageSize + "&parentcode=gender").then(res => {
                this.dictionary = res.data.records;
                this.options= res.data.records;
})

三、赋值

dictionaryFormatter(row, column) {
           var name = "";
           this.dictionary.forEach(function (item, index) {
               if (row.matchGender == item.dicvalue) {
                   name = item.dicname;
               }
           });
           return name;
}
 类似资料: