[new feature] Toast: add className prop (#2680)

This commit is contained in:
neverland 2019-02-03 12:22:38 +08:00 committed by GitHub
parent d20b7fdcbf
commit ca4e476ddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 3 deletions

View File

@ -97,7 +97,7 @@ export default {
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|------|------|------|------|------|
| name | 标识符 | 任意类型 | - | - |
| shape | 形状,可选值为 `square` | `String` | `round` | 1.5.8 |
| shape | 形状,可选值为 `square` | `String` | `round` | 1.6.0 |
| disabled | 是否为禁用状态 | `Boolean` | `false` | - |
| label-disabled | 是否禁用文本内容点击 | `Boolean` | `false` | 1.1.13 |
| label-position | 文本位置,可选值为 `left` | `String` | `right` | 1.1.13 |

View File

@ -10,6 +10,7 @@ export default sfc({
mixins: [Popup],
props: {
className: String,
forbidClick: Boolean,
message: [String, Number],
type: {
@ -89,7 +90,7 @@ export default sfc({
return (
<transition name="van-fade">
<div vShow={this.value} class={bem([style, this.position])}>
<div vShow={this.value} class={[bem([style, this.position]), this.className]}>
{Content()}
</div>
</transition>

View File

@ -104,4 +104,5 @@ toast2.clear();
| mask | Whether to show mask | `Boolean` | `false` |
| forbidClick | Whether to forbid click background | `Boolean` | `false` |
| loadingType | Loading icon type, can be set to `spinner` | `String` | `circular` |
| duration | Toast duration(ms), won't disappear if value is 0 | `Number` | `3000` |
| duration | Toast duration(ms), won't disappear if value is 0 | `Number` | `3000` |
| className | Custom className | `String | Array | Object` | - |

View File

@ -8,6 +8,7 @@ const defaultOptions = {
message: '',
value: true,
duration: 3000,
className: '',
position: 'middle',
loadingType: 'circular',
forbidClick: false,

1
types/toast.d.ts vendored
View File

@ -8,6 +8,7 @@ export type ToastOptions = {
mask?: boolean;
position?: string;
duration?: number;
className?: any;
forbidClick?: boolean;
loadingType?: string;
message?: ToastMessage;