From e5a92fe6a9ebe1c6d7a2c7b2a9ae5bb7637a2208 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 9 Oct 2021 10:17:56 +0800 Subject: [PATCH] fix(ActionSheet): closeOnPopstate prop not work (#9644) --- packages/vant/src/action-sheet/ActionSheet.tsx | 13 +++++++++---- packages/vant/src/action-sheet/README.md | 2 +- packages/vant/src/action-sheet/README.zh-CN.md | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/vant/src/action-sheet/ActionSheet.tsx b/packages/vant/src/action-sheet/ActionSheet.tsx index a55035b21..d7ff32697 100644 --- a/packages/vant/src/action-sheet/ActionSheet.tsx +++ b/packages/vant/src/action-sheet/ActionSheet.tsx @@ -27,6 +27,13 @@ export type ActionSheetAction = { className?: unknown; }; +const popupKeys = [ + ...popupSharedPropKeys, + 'round', + 'closeOnPopstate', + 'safeAreaInsetBottom', +] as const; + export default defineComponent({ name, @@ -38,7 +45,7 @@ export default defineComponent({ closeable: truthProp, cancelText: String, description: String, - closeOnPopstate: Boolean, + closeOnPopstate: truthProp, closeOnClickAction: Boolean, safeAreaInsetBottom: truthProp, }), @@ -140,10 +147,8 @@ export default defineComponent({ return () => ( {renderHeader()} diff --git a/packages/vant/src/action-sheet/README.md b/packages/vant/src/action-sheet/README.md index 8e13cb5a2..eff93959f 100644 --- a/packages/vant/src/action-sheet/README.md +++ b/packages/vant/src/action-sheet/README.md @@ -185,7 +185,7 @@ export default { | overlay-style | Custom overlay style | _object_ | - | | 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` | +| close-on-popstate | Whether to close when popstate | _boolean_ | `true` | | close-on-click-action | Whether to close when an action is clicked | _boolean_ | `false` | | close-on-click-overlay | Whether to close when overlay is clicked | _boolean_ | `true` | | safe-area-inset-bottom | Whether to enable bottom safe area adaptation | _boolean_ | `true` | diff --git a/packages/vant/src/action-sheet/README.zh-CN.md b/packages/vant/src/action-sheet/README.zh-CN.md index 86638c13c..2442f28ee 100644 --- a/packages/vant/src/action-sheet/README.zh-CN.md +++ b/packages/vant/src/action-sheet/README.zh-CN.md @@ -195,7 +195,7 @@ export default { | overlay-style | 自定义遮罩层样式 | _object_ | - | | lock-scroll | 是否锁定背景滚动 | _boolean_ | `true` | | lazy-render | 是否在显示弹层时才渲染节点 | _boolean_ | `true` | -| close-on-popstate | 是否在页面回退时自动关闭 | _boolean_ | `false` | +| close-on-popstate | 是否在页面回退时自动关闭 | _boolean_ | `true` | | close-on-click-action | 是否在点击选项后关闭 | _boolean_ | `false` | | close-on-click-overlay | 是否在点击遮罩层后关闭 | _boolean_ | `true` | | safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `true` |