diff --git a/src/dialog/Dialog.js b/src/dialog/Dialog.js index 1ea97ce3b..34033905c 100644 --- a/src/dialog/Dialog.js +++ b/src/dialog/Dialog.js @@ -1,13 +1,12 @@ import { createNamespace, addUnit } from '../utils'; import { BORDER_TOP, BORDER_LEFT } from '../utils/constant'; import { PopupMixin } from '../mixins/popup'; -import { CloseOnPopstateMixin } from '../mixins/close-on-popstate'; import Button from '../button'; const [createComponent, bem, t] = createNamespace('dialog'); export default createComponent({ - mixins: [PopupMixin, CloseOnPopstateMixin], + mixins: [PopupMixin], props: { title: String, diff --git a/src/image-preview/ImagePreview.js b/src/image-preview/ImagePreview.js index a9aa9fd5d..7f402caf7 100644 --- a/src/image-preview/ImagePreview.js +++ b/src/image-preview/ImagePreview.js @@ -3,7 +3,6 @@ import { range } from '../utils/format/number'; import { preventDefault } from '../utils/dom/event'; import { PopupMixin } from '../mixins/popup'; import { TouchMixin } from '../mixins/touch'; -import { CloseOnPopstateMixin } from '../mixins/close-on-popstate'; import Image from '../image'; import Loading from '../loading'; import Swipe from '../swipe'; @@ -19,7 +18,7 @@ function getDistance(touches) { } export default createComponent({ - mixins: [PopupMixin, TouchMixin, CloseOnPopstateMixin], + mixins: [PopupMixin, TouchMixin], props: { className: null, diff --git a/src/mixins/popup/index.js b/src/mixins/popup/index.js index afa9d0be3..5ca101653 100644 --- a/src/mixins/popup/index.js +++ b/src/mixins/popup/index.js @@ -1,6 +1,7 @@ import { context } from './context'; import { TouchMixin } from '../touch'; import { PortalMixin } from '../portal'; +import { CloseOnPopstateMixin } from '../close-on-popstate'; import { on, off, preventDefault } from '../../utils/dom/event'; import { openOverlay, closeOverlay, updateOverlay } from './overlay'; import { getScrollEventTarget } from '../../utils/dom/scroll'; @@ -8,6 +9,7 @@ import { getScrollEventTarget } from '../../utils/dom/scroll'; export const PopupMixin = { mixins: [ TouchMixin, + CloseOnPopstateMixin, PortalMixin({ afterPortal() { if (this.overlay) { diff --git a/src/popup/README.md b/src/popup/README.md index b82b6e4e1..cd44aeba1 100644 --- a/src/popup/README.md +++ b/src/popup/README.md @@ -127,6 +127,7 @@ export default { | round | Whether to show round corner | *boolean* | `false` | 2.0.7 | | lock-scroll | Whether to lock background scroll | *boolean* | `true` | - | | lazy-render | Whether to lazy render util appeared | *boolean* | `true` | - | +| close-on-popstate | Whether to close when popstate | *boolean* | `false` | 2.2.10 | | close-on-click-overlay | Whether to close when click overlay | *boolean* | `true` | - | | closeable | Whether to show close icon | *boolean* | `false` | 2.2.0 | | close-icon | Close icon name | *string* | `cross` | 2.2.0 | diff --git a/src/popup/README.zh-CN.md b/src/popup/README.zh-CN.md index 159f47fac..a6e2378fb 100644 --- a/src/popup/README.zh-CN.md +++ b/src/popup/README.zh-CN.md @@ -138,6 +138,7 @@ export default { | round | 是否显示圆角 | *boolean* | `false` | 2.0.7 | | lock-scroll | 是否锁定背景滚动 | *boolean* | `true` | - | | lazy-render | 是否在显示弹层时才渲染节点 | *boolean* | `true` | - | +| close-on-popstate | 是否在页面回退时自动关闭 | *boolean* | `false` | 2.2.10 | | close-on-click-overlay | 是否在点击遮罩层后关闭 | *boolean* | `true` | - | | closeable | 是否显示关闭图标 | *boolean* | `false` | 2.2.0 | | close-icon | 关闭图标名称或图片链接 | *string* | `cross` | 2.2.0 |