diff --git a/src/datepicker/index.js b/src/datepicker/index.js
index 79771c6..2eff499 100644
--- a/src/datepicker/index.js
+++ b/src/datepicker/index.js
@@ -243,11 +243,11 @@ export default Anot.component('datepicker', {
五
六
-
+
@@ -263,9 +263,9 @@ export default Anot.component('datepicker', {
现在
-
+
取消
- 确定
+ 确定
`
@@ -411,13 +411,22 @@ export default Anot.component('datepicker', {
this.calendar.month = month
this.resetCalendarTable()
},
- pick: function(item) {
+ pick: function(ev) {
+ if (ev.target === ev.currentTarget) {
+ return
+ }
+ let item = this.calendar.list[ev.target.dataset.idx]
+
if (item.disabled) {
return
}
this.calendar.day = item.day
changeStyle(this.calendar, item.day)
+
+ if (!this.props.showTime) {
+ this.confirmPick()
+ }
},
updateTime: function() {
let { year, month, day, hour, minute, second } = this.calendar
@@ -449,7 +458,7 @@ export default Anot.component('datepicker', {
close: function() {
this.showCalendar = false
},
- onConfirm: function() {
+ confirmPick: function() {
this.updateTime()
this.close()
if (
diff --git a/src/layer/index.js b/src/layer/index.js
index f04f58c..4171f02 100644
--- a/src/layer/index.js
+++ b/src/layer/index.js
@@ -174,11 +174,13 @@ class __layer__ {
this.$refs.layer.classList.remove('scale')
}, 100)
},
- onMaskClick: function() {
- if (this.type < 4 && !this.maskClose) {
- this.shake()
- } else {
- this.maskClose && this.close()
+ onMaskClick: function(ev) {
+ if (ev.target === ev.currentTarget) {
+ if (this.type < 4 && !this.maskClose) {
+ this.shake()
+ } else {
+ this.maskClose && this.close()
+ }
}
},
handleConfirm: function() {
@@ -206,10 +208,10 @@ class __layer__ {
},
close: function() {
close(this.$id)
- },
- cancelBubble: function(ev) {
- ev.cancelBubble = true
}
+ // cancelBubble: function(ev) {
+ // ev.cancelBubble = true
+ // }
},
mounted: function() {
if (typeof this.props.success === 'function') {
@@ -279,7 +281,7 @@ class __layer__ {
}
layBox.setAttribute('ref', 'layer')
- layBox.setAttribute(':click', 'cancelBubble')
+ // layBox.setAttribute(':click', 'cancelBubble')
// 暂时隐藏,避免修正定位时,能看到闪一下
layBox.style.cssText += 'border-radius:' + state.radius + 'px'