1. Code
<el-form-item label="分屏数">
<el-select v-model="form.screens" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
2. Pay attention
1. The value displayed by the v-module attribute in el-select is the value selected by el-option by default. 2. The
label attribute in el-option is the value displayed in the drop-down list on the front-end page, and the value attribute is The value 3 we pass into the backend
is included in the fact that we want to fetch data from the database and assign the value to form.screens so that multiple el-options can be selected by default. The value in form.screens here is the value of value. Only then can el-option be selected by default, but not label.
4. When we select an el-option and print the value of form.screens, the result is the value of value, not the value of label.