一、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;
}