需求:在新增页面下拉选项多选之后,在编辑页面要回显出来(新增页跟编辑页共用一个页面)
<el-form-item label="锁类型" prop="selectListvalue"><el-selectv-model="selectListvalue"multipleplaceholder="请选择锁类型"><el-optionv-for="item in locktypelist":key="item.value":label="item.label":value="item.value"></el-option></el-select></el-form-item>
data() {return {selectListvalue:[],//连点noClick:true,isAdd: true, //表明新增还是编辑addOrUpdateVisible: false,locktypelist:[],dataForm: {Locktype:[],},dataRules: {},};},
showAndInit(row) {//编辑if (row) {this.addOrUpdateVisible = true;this.isAdd = false;this.dataForm = JSON.parse(JSON.stringify(row));this.selectListvalue = this.dataForm.lockType.split(',') || [];//此处下拉多选回显赋值//新增} else {this.addOrUpdateVisible = true;this.isAdd = true;this.dataForm = {lockType: []};}},