提交 6c4a6f42 编写于 作者: D dolymood

fix(segment-picker): fix can not hide bug

#597
上级 26898a4c
<template> <template>
<div class="cube-segment-picker"> <div class="cube-segment-picker" v-show="isVisible">
<!-- Direct props will recover the property from v-bind Object expect 'is'. --> <!-- Direct props will recover the property from v-bind Object expect 'is'. -->
<!-- To ensure the priority of v-bind Object which is from user configure, we check the property of item in every prop. --> <!-- To ensure the priority of v-bind Object which is from user configure, we check the property of item in every prop. -->
<component <component
...@@ -93,13 +93,15 @@ ...@@ -93,13 +93,15 @@
if (this.isVisible || !this.data.length) { if (this.isVisible || !this.data.length) {
return return
} }
this.isVisible = true
this.currentPicker.show() this.currentPicker.show()
}, },
hide() { hide() {
if (!this.isVisible || !this.data.length) { if (!this.isVisible || !this.data.length) {
return return
} }
this.$refs.currentPicker.hide() this.isVisible = false
this.currentPicker.hide()
}, },
_select(...args) { _select(...args) {
this.selectedVal[this.current] = args[0] this.selectedVal[this.current] = args[0]
...@@ -111,6 +113,7 @@ ...@@ -111,6 +113,7 @@
this.current++ this.current++
this.currentPicker.show() this.currentPicker.show()
} else { } else {
this.isVisible = false
this.$emit(EVENT_SELECT, this.selectedVal, this.selectedIndex, this.selectedText) this.$emit(EVENT_SELECT, this.selectedVal, this.selectedIndex, this.selectedText)
this.current = 0 this.current = 0
} }
...@@ -121,6 +124,7 @@ ...@@ -121,6 +124,7 @@
this.current-- this.current--
this.currentPicker.show() this.currentPicker.show()
} else { } else {
this.isVisible = false
this.$emit(EVENT_CANCEL) this.$emit(EVENT_CANCEL)
} }
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册