优化重构

This commit is contained in:
xuliangzhan
2020-03-02 10:39:41 +08:00
parent 9d9370dc3f
commit 7331a87a64
2 changed files with 11 additions and 7 deletions

View File

@@ -5,8 +5,8 @@ let optionUniqueId = 0
export default {
name: 'VxeOption',
props: {
value: [String, Number],
label: [String, Number],
value: null,
label: [String, Number, Boolean],
disabled: Boolean,
size: String
},
@@ -44,7 +44,7 @@ export default {
this.updateView()
},
render (h) {
const { $xeselect, id, isDisabled, value } = this
const { $slots, $xeselect, id, isDisabled, value } = this
return h('div', {
class: ['vxe-select-option', {
'is--disabled': isDisabled,
@@ -58,17 +58,21 @@ export default {
click: this.optionEvent,
mouseenter: this.mouseenterEvent
}
}, UtilTools.getFuncText(this.label))
}, $slots.default || UtilTools.getFuncText(this.label))
},
methods: {
updateView () {
this.$xeselect.updateStatus()
},
optionEvent (evnt) {
this.$xeselect.changeOptionEvent(evnt, this.value)
if (!this.isDisabled) {
this.$xeselect.changeOptionEvent(evnt, this.value)
}
},
mouseenterEvent () {
this.$xeselect.setCurrentOption(this)
if (!this.isDisabled) {
this.$xeselect.setCurrentOption(this)
}
}
}
}

View File

@@ -72,7 +72,7 @@ function findOption (groupList, optionValue) {
export default {
name: 'VxeSelect',
props: {
value: [String, Number],
value: null,
clearable: Boolean,
placeholder: String,
disabled: Boolean,