perf: 文本下拉选择首项

This commit is contained in:
fit2cloud-chenyw 2023-11-08 14:21:54 +08:00
parent cc168d8661
commit 08edc27cf7

View File

@ -144,7 +144,7 @@ export default {
watch: { watch: {
'viewIds': function(value, old) { 'viewIds': function(value, old) {
if (typeof value === 'undefined' || value === old) return if (typeof value === 'undefined' || value === old) return
this.value = this.fillFirstValue() this.fillFirstValue()
this.setCondition() this.setCondition()
}, },
'defaultValueStr': function(value, old) { 'defaultValueStr': function(value, old) {
@ -180,7 +180,12 @@ export default {
}, },
'selectFirst': function(value, old) { 'selectFirst': function(value, old) {
if (value === old) return if (value === old) return
this.fillFirstValue() if (value) {
this.fillFirstValue()
} else {
this.value = ''
this.firstChange(this.value)
}
}, },
'element.options.attrs.multiple': function(value, old) { 'element.options.attrs.multiple': function(value, old) {
if (typeof old === 'undefined' || value === old) return if (typeof old === 'undefined' || value === old) return
@ -285,6 +290,11 @@ export default {
}, },
resetDefaultValue(id) { resetDefaultValue(id) {
if (this.inDraw && this.manualModify && this.element.id === id) { if (this.inDraw && this.manualModify && this.element.id === id) {
if (this.selectFirst) {
this.fillFirstValue()
this.firstChange(this.value)
return
}
this.value = this.fillValueDerfault() this.value = this.fillValueDerfault()
this.changeValue(this.value) this.changeValue(this.value)
} }
@ -311,7 +321,7 @@ export default {
this.fillFirstValue() this.fillFirstValue()
this.$emit('filter-loaded', { this.$emit('filter-loaded', {
componentId: this.element.id, componentId: this.element.id,
val: this.value val: (this.value && Array.isArray(this.value)) ? this.value.join(',') : this.value
}) })
} }
}, },