mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat: ActionSheet、ShareSheet add before-close prop (#9068)
This commit is contained in:
parent
eaa9bf3680
commit
29c63a905b
@ -190,6 +190,7 @@ export default {
|
|||||||
| close-on-click-overlay | Whether to close when overlay is clicked | _boolean_ | `true` |
|
| 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` |
|
| safe-area-inset-bottom | Whether to enable bottom safe area adaptation | _boolean_ | `true` |
|
||||||
| teleport | Specifies a target element where ActionSheet will be mounted | _string \| Element_ | - |
|
| teleport | Specifies a target element where ActionSheet will be mounted | _string \| Element_ | - |
|
||||||
|
| before-close `v3.1.4` | Callback function before close | _(action: string) => boolean \| Promise\<boolean\>_ | - |
|
||||||
|
|
||||||
### Data Structure of Action
|
### Data Structure of Action
|
||||||
|
|
||||||
|
@ -200,6 +200,7 @@ export default {
|
|||||||
| close-on-click-overlay | 是否在点击遮罩层后关闭 | _boolean_ | `true` |
|
| close-on-click-overlay | 是否在点击遮罩层后关闭 | _boolean_ | `true` |
|
||||||
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `true` |
|
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `true` |
|
||||||
| teleport | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | - |
|
| teleport | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | - |
|
||||||
|
| before-close `v3.1.4` | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(action: string) => boolean \| Promise\<boolean\>_ | - |
|
||||||
|
|
||||||
### Action 数据结构
|
### Action 数据结构
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { PropType, reactive, defineComponent } from 'vue';
|
import { PropType, reactive, defineComponent } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { callInterceptor, Interceptor } from '../utils/interceptor';
|
|
||||||
import {
|
import {
|
||||||
pick,
|
pick,
|
||||||
extend,
|
extend,
|
||||||
@ -11,6 +10,7 @@ import {
|
|||||||
unknownProp,
|
unknownProp,
|
||||||
createNamespace,
|
createNamespace,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
|
import { callInterceptor } from '../utils/interceptor';
|
||||||
import { BORDER_TOP, BORDER_LEFT } from '../utils/constant';
|
import { BORDER_TOP, BORDER_LEFT } from '../utils/constant';
|
||||||
import { popupSharedProps, popupSharedPropKeys } from '../popup/shared';
|
import { popupSharedProps, popupSharedPropKeys } from '../popup/shared';
|
||||||
|
|
||||||
@ -44,7 +44,6 @@ export default defineComponent({
|
|||||||
callback: Function as PropType<(action?: DialogAction) => void>,
|
callback: Function as PropType<(action?: DialogAction) => void>,
|
||||||
allowHtml: Boolean,
|
allowHtml: Boolean,
|
||||||
className: unknownProp,
|
className: unknownProp,
|
||||||
beforeClose: Function as PropType<Interceptor>,
|
|
||||||
messageAlign: String as PropType<DialogMessageAlign>,
|
messageAlign: String as PropType<DialogMessageAlign>,
|
||||||
closeOnPopstate: truthProp,
|
closeOnPopstate: truthProp,
|
||||||
showCancelButton: Boolean,
|
showCancelButton: Boolean,
|
||||||
|
@ -16,7 +16,7 @@ import {
|
|||||||
// Utils
|
// Utils
|
||||||
import { popupSharedProps } from './shared';
|
import { popupSharedProps } from './shared';
|
||||||
import { createNamespace, extend, isDef } from '../utils';
|
import { createNamespace, extend, isDef } from '../utils';
|
||||||
import { callInterceptor, Interceptor } from '../utils/interceptor';
|
import { callInterceptor } from '../utils/interceptor';
|
||||||
|
|
||||||
// Composables
|
// Composables
|
||||||
import { useEventListener } from '@vant/use';
|
import { useEventListener } from '@vant/use';
|
||||||
@ -51,7 +51,6 @@ export default defineComponent({
|
|||||||
closeable: Boolean,
|
closeable: Boolean,
|
||||||
transition: String,
|
transition: String,
|
||||||
iconPrefix: String,
|
iconPrefix: String,
|
||||||
beforeClose: Function as PropType<Interceptor>,
|
|
||||||
closeOnPopstate: Boolean,
|
closeOnPopstate: Boolean,
|
||||||
safeAreaInsetBottom: Boolean,
|
safeAreaInsetBottom: Boolean,
|
||||||
position: {
|
position: {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { PropType, CSSProperties, TeleportProps } from 'vue';
|
import { PropType, CSSProperties, TeleportProps } from 'vue';
|
||||||
import { truthProp, unknownProp } from '../utils';
|
import { truthProp, unknownProp } from '../utils';
|
||||||
|
import type { Interceptor } from '../utils/interceptor';
|
||||||
|
|
||||||
export const popupSharedProps = {
|
export const popupSharedProps = {
|
||||||
// whether to show popup
|
// whether to show popup
|
||||||
@ -16,6 +17,8 @@ export const popupSharedProps = {
|
|||||||
lockScroll: truthProp,
|
lockScroll: truthProp,
|
||||||
// whether to lazy render
|
// whether to lazy render
|
||||||
lazyRender: truthProp,
|
lazyRender: truthProp,
|
||||||
|
// callback function before close
|
||||||
|
beforeClose: Function as PropType<Interceptor>,
|
||||||
// overlay custom style
|
// overlay custom style
|
||||||
overlayStyle: Object as PropType<CSSProperties>,
|
overlayStyle: Object as PropType<CSSProperties>,
|
||||||
// overlay custom class name
|
// overlay custom class name
|
||||||
|
@ -183,6 +183,7 @@ export default {
|
|||||||
| close-on-click-overlay | Whether to close when overlay is clicked | _boolean_ | `true` |
|
| 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` |
|
| safe-area-inset-bottom | Whether to enable bottom safe area adaptation | _boolean_ | `true` |
|
||||||
| teleport | Specifies a target element where ShareSheet will be mounted | _string \| Element_ | - |
|
| teleport | Specifies a target element where ShareSheet will be mounted | _string \| Element_ | - |
|
||||||
|
| before-close `v3.1.4` | Callback function before close | _(action: string) => boolean \| Promise\<boolean\>_ | - |
|
||||||
|
|
||||||
### Data Structure of Option
|
### Data Structure of Option
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ export default {
|
|||||||
| close-on-click-overlay | 是否在点击遮罩层后关闭 | _boolean_ | `true` |
|
| close-on-click-overlay | 是否在点击遮罩层后关闭 | _boolean_ | `true` |
|
||||||
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `true` |
|
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `true` |
|
||||||
| teleport | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | - |
|
| teleport | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | - |
|
||||||
|
| before-close `v3.1.4` | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(action: string) => boolean \| Promise\<boolean\>_ | - |
|
||||||
|
|
||||||
### Option 数据结构
|
### Option 数据结构
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user