mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Popup): add close-on-popstate prop (#4845)
This commit is contained in:
parent
44c9801811
commit
9033a968ec
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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 |
|
||||
|
@ -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 |
|
||||
|
Loading…
x
Reference in New Issue
Block a user