mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Toast): add transition option (#4638)
This commit is contained in:
parent
3e522d35e6
commit
be2a1bf91c
@ -127,4 +127,5 @@ toast2.clear();
|
|||||||
| className | Custom className | *any* | - | - |
|
| className | Custom className | *any* | - | - |
|
||||||
| onOpened | Callback function after opened | *Function* | - | - |
|
| onOpened | Callback function after opened | *Function* | - | - |
|
||||||
| onClose | Callback function after close | *Function* | - | - |
|
| onClose | Callback function after close | *Function* | - | - |
|
||||||
|
| transition | Transition, equivalent to `name` prop of [transtion](https://vuejs.org/v2/api/#transition) | *string* | - | 2.2.6 |
|
||||||
| getContainer | Return the mount node for Toast | *string \| () => Element* | `body` | - |
|
| getContainer | Return the mount node for Toast | *string \| () => Element* | `body` | - |
|
||||||
|
@ -127,4 +127,5 @@ toast2.clear();
|
|||||||
| className | 自定义类名 | *any* | - | - |
|
| className | 自定义类名 | *any* | - | - |
|
||||||
| onOpened | 完全展示后的回调函数 | *Function* | - | - |
|
| onOpened | 完全展示后的回调函数 | *Function* | - | - |
|
||||||
| onClose | 关闭时的回调函数 | *Function* | - | - |
|
| onClose | 关闭时的回调函数 | *Function* | - | - |
|
||||||
|
| transition | 动画类名,等价于 [transtion](https://cn.vuejs.org/v2/api/index.html#transition) 的`name`属性 | *string* | - | 2.2.6 |
|
||||||
| getContainer | 指定挂载的节点,可以传入选择器,<br>或一个返回节点的函数 | *string \| () => Element* | `body` | - |
|
| getContainer | 指定挂载的节点,可以传入选择器,<br>或一个返回节点的函数 | *string \| () => Element* | `body` | - |
|
||||||
|
@ -24,6 +24,10 @@ export default createComponent({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'middle'
|
default: 'middle'
|
||||||
},
|
},
|
||||||
|
transition: {
|
||||||
|
type: String,
|
||||||
|
default: 'van-fade'
|
||||||
|
},
|
||||||
lockScroll: {
|
lockScroll: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@ -109,7 +113,7 @@ export default createComponent({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<transition
|
<transition
|
||||||
name="van-fade"
|
name={this.transition}
|
||||||
onAfterEnter={this.onAfterEnter}
|
onAfterEnter={this.onAfterEnter}
|
||||||
onAfterLeave={this.onAfterLeave}
|
onAfterLeave={this.onAfterLeave}
|
||||||
>
|
>
|
||||||
|
@ -14,6 +14,7 @@ const defaultOptions = {
|
|||||||
duration: 3000,
|
duration: 3000,
|
||||||
iconPrefix: undefined,
|
iconPrefix: undefined,
|
||||||
position: 'middle',
|
position: 'middle',
|
||||||
|
transition: 'van-fade',
|
||||||
forbidClick: false,
|
forbidClick: false,
|
||||||
loadingType: undefined,
|
loadingType: undefined,
|
||||||
getContainer: 'body',
|
getContainer: 'body',
|
||||||
|
11
types/toast.d.ts
vendored
11
types/toast.d.ts
vendored
@ -7,15 +7,16 @@ export type ToastOptions = {
|
|||||||
icon?: string;
|
icon?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
mask?: boolean;
|
mask?: boolean;
|
||||||
position?: string;
|
message?: ToastMessage;
|
||||||
|
onClose?: () => void;
|
||||||
|
onOpened?: () => void;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
|
position?: string;
|
||||||
className?: any;
|
className?: any;
|
||||||
onClose?(): void;
|
transition?: string;
|
||||||
onOpened?(): void;
|
loadingType?: string;
|
||||||
forbidClick?: boolean;
|
forbidClick?: boolean;
|
||||||
closeOnClick?: boolean;
|
closeOnClick?: boolean;
|
||||||
loadingType?: string;
|
|
||||||
message?: ToastMessage;
|
|
||||||
getContainer?: string | (() => Element);
|
getContainer?: string | (() => Element);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user