How does the ElementUI Select selector display the corresponding label according to the value

The effect before modification is shown in the figure, the data value status should be displayed as available, but in fact only status code 1 is displayed, and its corresponding status information is not displayed. After checking the data type correspondence problem, there was no substantial impact, so the code had to be modified as follows.
insert image description here
Code before modification:

<el-select v-model="datasetInfo.status" placeholder="请选择数据集状态">
          <el-option label="可用" value=1></el-option>
          <el-option label="不可用" value=0></el-option>
</el-select>

insert image description here
Modified code:

<el-select v-model="datasetInfo.status" placeholder="请选择数据集状态">
	<el-option v-for="item in options" :value="item.value":label="item.label">
	</el-option>
</el-select>
export default {
    
    
  data() {
    
    
    return {
    
    
      options: [
        {
    
    
          value: 0,
          label: '不可用'
        },
        {
    
    
          value: 1,
          label: '可用'
        }
      ]
    }
  }
}

Guess you like

Origin blog.csdn.net/WuwuwuH_/article/details/131959311