From dd426f13dc7fd7040ea47a194f835f732a019ae4 Mon Sep 17 00:00:00 2001 From: linhaobin Date: Thu, 11 Jan 2018 15:14:34 +0800 Subject: [PATCH] fix `on-hide` event trigger twice #2379 --- src/components/datetime/index.vue | 4 ++++ src/components/datetime/metas.yml | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/datetime/index.vue b/src/components/datetime/index.vue index 711af0e0d..a5bf94aca 100755 --- a/src/components/datetime/index.vue +++ b/src/components/datetime/index.vue @@ -138,6 +138,7 @@ export default { }, data () { return { + currentShow: false, currentValue: null, valid: true, errors: {} @@ -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) @@ -201,6 +203,7 @@ export default { } }, onShow () { + _this.currentShow = true _this.$emit('update:show', true) _this.$emit('on-show') } @@ -257,6 +260,7 @@ export default { } }, show (val) { + if (val === this.currentShow) return if (val) { this.picker && this.picker.show(this.currentValue) } else { diff --git a/src/components/datetime/metas.yml b/src/components/datetime/metas.yml index ad9ed63e8..30177d7be 100644 --- a/src/components/datetime/metas.yml +++ b/src/components/datetime/metas.yml @@ -3,12 +3,12 @@ extra: |

需要在`Group`组件里使用

- - + + 该组件支持以`plugin`形式调用: - + ``` - // 以 plugin 形式使用时,请在入口处引入: + // 以 plugin 形式使用时,请在入口处引入: import { DatetimePlugin } from 'vux' Vue.use(DatetimePlugin) @@ -25,7 +25,7 @@ extra: | this.$vux.datetime.hide() ``` - + tags: en: - date @@ -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'