!35 分类筛选器和图标选择器的优化

Merge pull request !35 from orangeJ/fix/select
This commit is contained in:
sakuya 2022-06-24 06:34:55 +00:00 committed by Gitee
commit 8b5d351983
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 6 additions and 3 deletions

View File

@ -74,6 +74,7 @@
} }
}, },
mounted() { mounted() {
this.value = this.modelValue
this.data.push(...config.icons) this.data.push(...config.icons)
}, },
methods: { methods: {

View File

@ -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: {

View File

@ -36,7 +36,7 @@
data() { data() {
return { return {
form: { form: {
icon: '' icon: 'el-icon-apple'
}, },
rules: { rules: {
icon: [ icon: [