Skip to content

Commit

Permalink
fix(segment-picker): fix can not hide bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dolymood committed Sep 16, 2019
1 parent 26898a4 commit 6c4a6f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/segment-picker/segment-picker.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<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'. -->
<!-- To ensure the priority of v-bind Object which is from user configure, we check the property of item in every prop. -->
<component
Expand Down Expand Up @@ -93,13 +93,15 @@
if (this.isVisible || !this.data.length) {
return
}
this.isVisible = true
this.currentPicker.show()
},
hide() {
if (!this.isVisible || !this.data.length) {
return
}
this.$refs.currentPicker.hide()
this.isVisible = false
this.currentPicker.hide()
},
_select(...args) {
this.selectedVal[this.current] = args[0]
Expand All @@ -111,6 +113,7 @@
this.current++
this.currentPicker.show()
} else {
this.isVisible = false
this.$emit(EVENT_SELECT, this.selectedVal, this.selectedIndex, this.selectedText)
this.current = 0
}
Expand All @@ -121,6 +124,7 @@
this.current--
this.currentPicker.show()
} else {
this.isVisible = false
this.$emit(EVENT_CANCEL)
}
},
Expand Down

0 comments on commit 6c4a6f4

Please sign in to comment.