Skip to content

Commit

Permalink
fix on-hide event trigger twice airyland#2379
Browse files Browse the repository at this point in the history
  • Loading branch information
linhaobin committed Jan 11, 2018
1 parent 6de6a06 commit dd426f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/components/datetime/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export default {
},
data () {
return {
currentShow: false,
currentValue: null,
valid: true,
errors: {}
Expand Down Expand Up @@ -190,6 +191,7 @@ export default {
_this.$emit('on-clear', value)
},
onHide (type) {
_this.currentShow = false
_this.$emit('update:show', false)
_this.validate()
_this.$emit('on-hide', type)
Expand All @@ -201,6 +203,7 @@ export default {
}
},
onShow () {
_this.currentShow = true
_this.$emit('update:show', true)
_this.$emit('on-show')
}
Expand Down Expand Up @@ -257,6 +260,7 @@ export default {
}
},
show (val) {
if (val === this.currentShow) return
if (val) {
this.picker && this.picker.show(this.currentValue)
} else {
Expand Down
15 changes: 10 additions & 5 deletions src/components/datetime/metas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ extra: |
<p class="tip">
需要在`Group`组件里使用
</p>
该组件支持以`plugin`形式调用:
```
// 以 plugin 形式使用时,请在入口处引入:
// 以 plugin 形式使用时,请在入口处引入:
import { DatetimePlugin } from 'vux'
Vue.use(DatetimePlugin)
Expand All @@ -25,7 +25,7 @@ extra: |
this.$vux.datetime.hide()
```
tags:
en:
- date
Expand Down Expand Up @@ -205,6 +205,11 @@ events:
en: fires when confirm button is clicked
zh-CN: 点击确定按钮时触发,等同于事件 on-hide(confirm)
changes:
next:
en:
- '[fix] fix `on-hide` event trigger twice #2379'
zh-CN:
- '[fix] 修复 `on-hide` 事件触发两次的问题 #2379'
2.7.6:
en:
- '[fix] column value use number type, fix binding value is not equal to datetimepicker value #2296'
Expand Down

0 comments on commit dd426f1

Please sign in to comment.