The data of the vue elementUI drop-down box is bound bidirectionally, and the bound value is empty.

problem description:

there is a requirement in the project, that is, the form is submitted with a drop-down box, and the drop-down box is at the hospital level, while different hospitals have different scores. Select different hospitals, fill in the scores automatically below, and finally submit the data.

the current bug: score binds successfully, but the level (academicLevel) field is always empty when the final submission is made.

related codes

  • template Code
academic: [{category: "", score: 1}, {category: "", score: 2}, {category: "", score: 4},]
0: {category: "", score: 1}
1: {category: "", score: 2}
2: {category: "", score: 4}
3: {category: "", score: 4}
4: {category: "", score: 4}
5: {category: "", score: 4}
6: {category: "", score: 6}
7: {category: "", score: 6}
8: {category: "", score: 6}

expected result:

the drop-down box selects the hospital of traditional Chinese medicine, automatically binds the score below, and finally submits it.

Oct.29,2021

v Merry model = "academicForm.academicLevel"

<el-select v-model="academicForm.academicLevel" placeholder="" @change="currentSel">
          <el-option v-for="item in postLevel" :key="item.category" :label="item.category" :value="item.score">
          </el-option>
        </el-select>
Menu