Previous address on the drop-down box to el-select default values in the drop-down box pass in vue
If you are to solve the bug, skip to Section 3
<el-select v-model="form.Name">
<el-option v-for="item in dqList" :key="item.dqId" :label="item.name" :value="item.dqId"></el-option>
</el-select>
1. As I want dqid name and values are passed to the background, were passed to Name and Code
we put :value
instead json
:value="{'Code':item.dqid,'Name':item.name}">
Note that there may occur a bug that you select any of the content, is a fixed name suggests, does not change
into this to try (uh, this is no bug been tested, but not receiving the value of the background on )
:value="[{'Code':item.dqid,'Name':item.name}]">
2. :value="{'Code':item.dqid,'Name':item.name}">
bug selected value will not change the appearance of
the Internet the most common solution
this.$set(this.form, 'Name', this.form.Name.Name)
But it is not easy to use, write back not receiving value, naught
3. The reference methods for the author of vue-element selection box to select the value changes, the display does not change
our code modified to
<el-select v-model="form.Name" @input="change">
<el-option v-for="(item, index) in dqList" :key="item.dqId" :label="item.name" :value="index"></el-option>
</el-select>
change (index) {
this.form.Name = this.dqList[index].name
this.form.Code = this.dqList[index].dqId
},
Wrote upon returning to the parameters of the background
'Name': this.form.Name,
'Code': this.form.Code,
Note; This method does not support clearable