diff --git a/src/action-sheet/index.tsx b/src/action-sheet/index.tsx index a392119eb..3ff354544 100644 --- a/src/action-sheet/index.tsx +++ b/src/action-sheet/index.tsx @@ -1,7 +1,7 @@ import { createNamespace } from '../utils'; import { emit, inherit } from '../utils/functional'; import { BORDER_TOP, BORDER_BOTTOM } from '../utils/constant'; -import { PopupMixin } from '../mixins/popup'; +import { popupMixinProps } from '../mixins/popup'; import Icon from '../icon'; import Popup from '../popup'; import Loading from '../loading'; @@ -152,7 +152,7 @@ function ActionSheet( } ActionSheet.props = { - ...PopupMixin.props, + ...popupMixinProps, title: String, actions: Array, duration: Number, diff --git a/src/dialog/Dialog.js b/src/dialog/Dialog.js index 32bf459f1..41799eb05 100644 --- a/src/dialog/Dialog.js +++ b/src/dialog/Dialog.js @@ -6,7 +6,7 @@ import Button from '../button'; const [createComponent, bem, t] = createNamespace('dialog'); export default createComponent({ - mixins: [PopupMixin], + mixins: [PopupMixin()], props: { title: String, diff --git a/src/image-preview/ImagePreview.js b/src/image-preview/ImagePreview.js index 1409c0519..d8917b66c 100644 --- a/src/image-preview/ImagePreview.js +++ b/src/image-preview/ImagePreview.js @@ -18,7 +18,12 @@ function getDistance(touches) { } export default createComponent({ - mixins: [PopupMixin, TouchMixin], + mixins: [ + PopupMixin({ + skipToggleEvent: true + }), + TouchMixin + ], props: { className: null, @@ -83,8 +88,8 @@ export default createComponent({ }; if (scale !== 1) { - style.transform = `scale3d(${scale}, ${scale}, 1) translate(${this.moveX / - scale}px, ${this.moveY / scale}px)`; + style.transform = `scale3d(${scale}, ${scale}, 1) translate(${this + .moveX / scale}px, ${this.moveY / scale}px)`; } return style; @@ -92,8 +97,15 @@ export default createComponent({ }, watch: { - value() { + value(val) { this.setActive(this.startPosition); + + if (!val) { + this.$emit('close', { + index: this.active, + url: this.images[this.active] + }); + } }, startPosition(active) { @@ -116,14 +128,7 @@ export default createComponent({ if (deltaTime < 300 && offsetX < 10 && offsetY < 10) { if (!this.doubleClickTimer) { this.doubleClickTimer = setTimeout(() => { - const index = this.active; - if (!this.asyncClose) { - this.$emit('close', { - index, - url: this.images[index] - }); - this.$emit('input', false); } @@ -248,7 +253,8 @@ export default createComponent({ if (this.showIndex) { return (