element中select多选回显
<el-table>
<el-button type="text" @click="editList(scope.row)">编辑</el-button>
</el-table>
<el-form-item label="任务类型" prop="type">
<el-select
v-model="form.type"
filterable
multiple
clearable
placeholder="请选择类型"
>
<el-option
v-for="(item, index) in options"
:key="index"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<script>
export default {
data() {
return {
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
}
}
}
</script>
回显方法
getLstInteger(row) {
console.log(row, "回显");
this.form = {
...row,
type: JSON.parse(row.type),
};
},
编辑方法
// 编辑
editList(row) {
this.getLstInteger(row);
},