提交 77dda57e 编写于 作者: D dolymood

select use $props & $events

上级 877ffcda
...@@ -77,38 +77,30 @@ ...@@ -77,38 +77,30 @@
return index return index
}, },
selectedIndex() {
return this.valueIndex !== -1 ? [this.valueIndex] : [0]
},
selectedText() { selectedText() {
return this.valueIndex !== -1 ? this.adaptOptions[0][this.valueIndex].text : '' return this.valueIndex !== -1 ? this.adaptOptions[0][this.valueIndex].text : ''
},
txts() {
return {
title: this.title,
confirmTxt: this.confirmTxt,
cancelTxt: this.cancelTxt
}
}
},
watch: {
txts() {
this.updatePicker()
} }
}, },
created() { created() {
this.picker = this.$createPicker({ this.picker = this.$createPicker({
title: this.title, $props: {
data: this.adaptOptions, title: 'title',
selectedIndex: this.valueIndex !== -1 ? [this.valueIndex] : [0], data: 'adaptOptions',
cancelTxt: this.cancelTxt, selectedIndex: 'selectedIndex',
confirmTxt: this.confirmTxt, cancelTxt: 'cancelTxt',
onSelect: this.selectHandler, confirmTxt: 'confirmTxt'
onCancel: this.hided },
$events: {
select: 'selectHandler',
cancel: this.hided
}
}) })
this.autoPop && this.showPicker() this.autoPop && this.showPicker()
}, },
methods: { methods: {
updatePicker() {
this.picker.$updateProps(this.txts)
},
showPicker() { showPicker() {
if (this.disabled) { if (this.disabled) {
return return
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册