修复选项为空时的异常
This commit is contained in:
parent
2e958963ff
commit
8bba9fda23
|
@ -42,7 +42,8 @@
|
||||||
watch:{
|
watch:{
|
||||||
data(val) {
|
data(val) {
|
||||||
val.forEach(item => {
|
val.forEach(item => {
|
||||||
this.selected[item.key] = this.selectedValues[item.key] || [item.options[0].value]
|
this.selected[item.key] = this.selectedValues[item.key] ||
|
||||||
|
(Array.isArray(item.options) && item.options.length) ? [item.options[0].value] : []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -58,7 +59,8 @@
|
||||||
mounted() {
|
mounted() {
|
||||||
//默认赋值
|
//默认赋值
|
||||||
this.data.forEach(item => {
|
this.data.forEach(item => {
|
||||||
this.selected[item.key] = this.selectedValues[item.key] || [item.options[0].value]
|
this.selected[item.key] = this.selectedValues[item.key] ||
|
||||||
|
(Array.isArray(item.options) && item.options.length) ? [item.options[0].value] : []
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in New Issue