mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[new feature] Loading: add vertical prop
This commit is contained in:
parent
e3cb465dc2
commit
0fb755b136
@ -68,6 +68,7 @@
|
|||||||
### Loading
|
### Loading
|
||||||
|
|
||||||
- 新增`default`插槽
|
- 新增`default`插槽
|
||||||
|
- 新增`vertical`属性
|
||||||
- 新增`text-size`属性
|
- 新增`text-size`属性
|
||||||
- 支持`Number`类型的`size`属性
|
- 支持`Number`类型的`size`属性
|
||||||
|
|
||||||
@ -80,6 +81,10 @@
|
|||||||
- 新增`left-icon`插槽
|
- 新增`left-icon`插槽
|
||||||
- 新增`right-icon`插槽
|
- 新增`right-icon`插槽
|
||||||
|
|
||||||
|
### SubmitBar
|
||||||
|
|
||||||
|
- 新增`tip-icon`属性
|
||||||
|
|
||||||
### Steps
|
### Steps
|
||||||
|
|
||||||
- 新增`inactive-icon`属性
|
- 新增`inactive-icon`属性
|
||||||
@ -94,3 +99,4 @@
|
|||||||
|
|
||||||
- 新增`preview-open`事件
|
- 新增`preview-open`事件
|
||||||
- 新增`preview-close`事件
|
- 新增`preview-close`事件
|
||||||
|
|
@ -18,6 +18,15 @@
|
|||||||
{{ $t('loading') }}
|
{{ $t('loading') }}
|
||||||
</van-loading>
|
</van-loading>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
|
<demo-block :title="$t('vertical')">
|
||||||
|
<van-loading
|
||||||
|
size="24px"
|
||||||
|
vertical
|
||||||
|
>
|
||||||
|
{{ $t('loading') }}
|
||||||
|
</van-loading>
|
||||||
|
</demo-block>
|
||||||
</demo-section>
|
</demo-section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -27,12 +36,14 @@ export default {
|
|||||||
'zh-CN': {
|
'zh-CN': {
|
||||||
type: '加载类型',
|
type: '加载类型',
|
||||||
color: '自定义颜色',
|
color: '自定义颜色',
|
||||||
text: '加载文案'
|
text: '加载文案',
|
||||||
|
vertical: '垂直排列'
|
||||||
},
|
},
|
||||||
'en-US': {
|
'en-US': {
|
||||||
type: 'Type',
|
type: 'Type',
|
||||||
color: 'Color',
|
color: 'Color',
|
||||||
text: 'Text'
|
text: 'Text',
|
||||||
|
vertical: 'Vertical'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -43,6 +54,10 @@ export default {
|
|||||||
.van-loading {
|
.van-loading {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 5px 0 5px 20px;
|
margin: 5px 0 5px 20px;
|
||||||
|
|
||||||
|
&--vertical {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -29,6 +29,12 @@ Vue.use(Loading);
|
|||||||
<van-loading size="24px">Loading...</van-loading>
|
<van-loading size="24px">Loading...</van-loading>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Vertical
|
||||||
|
|
||||||
|
```html
|
||||||
|
<van-loading size="24px" vertical>Loading...</van-loading>
|
||||||
|
```
|
||||||
|
|
||||||
### Props
|
### Props
|
||||||
|
|
||||||
| Attribute | Description | Type | Default |
|
| Attribute | Description | Type | Default |
|
||||||
@ -37,6 +43,7 @@ Vue.use(Loading);
|
|||||||
| type | Can be set to `spinner` | `String` | `circular` |
|
| type | Can be set to `spinner` | `String` | `circular` |
|
||||||
| size | Icon size | `String | Number` | `30px` |
|
| size | Icon size | `String | Number` | `30px` |
|
||||||
| text-size | Text font size | `String | Number` | `14px` |
|
| text-size | Text font size | `String | Number` | `14px` |
|
||||||
|
| vertical | Whether to arrange icons and text content vertically | `Boolean` | `false` |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
@ -68,6 +68,17 @@
|
|||||||
line-height: @loading-text-line-height;
|
line-height: @loading-text-line-height;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--vertical {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.van-loading__text {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes van-circular {
|
@keyframes van-circular {
|
||||||
|
@ -11,6 +11,7 @@ export type LoadingProps = {
|
|||||||
type: LoadingType;
|
type: LoadingType;
|
||||||
size?: string | number;
|
size?: string | number;
|
||||||
color: string;
|
color: string;
|
||||||
|
vertical?: boolean;
|
||||||
textSize?: string | number;
|
textSize?: string | number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ function Loading(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={bem([type])} {...inherit(ctx, true)}>
|
<div class={bem([type, { vertical: props.vertical }])} {...inherit(ctx, true)}>
|
||||||
<span class={bem('spinner', type)} style={style}>
|
<span class={bem('spinner', type)} style={style}>
|
||||||
{Spin}
|
{Spin}
|
||||||
{Circular}
|
{Circular}
|
||||||
@ -73,6 +74,7 @@ function Loading(
|
|||||||
Loading.props = {
|
Loading.props = {
|
||||||
size: [String, Number],
|
size: [String, Number],
|
||||||
textSize: [String, Number],
|
textSize: [String, Number],
|
||||||
|
vertical: Boolean,
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'circular'
|
default: 'circular'
|
||||||
|
@ -15,5 +15,10 @@ exports[`renders demo correctly 1`] = `
|
|||||||
加载中...
|
加载中...
|
||||||
</span></div>
|
</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="van-loading van-loading--circular van-loading--vertical"><span class="van-loading__spinner van-loading__spinner--circular" style="color:#c9c9c9;width:24px;height:24px;"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span><span class="van-loading__text">
|
||||||
|
加载中...
|
||||||
|
</span></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@ -29,6 +29,12 @@ Vue.use(Loading);
|
|||||||
<van-loading size="24px">加载中...</van-loading>
|
<van-loading size="24px">加载中...</van-loading>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 垂直排列
|
||||||
|
|
||||||
|
```html
|
||||||
|
<van-loading size="24px" vertical>加载中...</van-loading>
|
||||||
|
```
|
||||||
|
|
||||||
### Props
|
### Props
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||||
@ -37,6 +43,7 @@ Vue.use(Loading);
|
|||||||
| type | 类型,可选值为 `spinner` | `String` | `circular` | - |
|
| type | 类型,可选值为 `spinner` | `String` | `circular` | - |
|
||||||
| size | 加载图标大小 | `String | Number` | `30px` | - |
|
| size | 加载图标大小 | `String | Number` | `30px` | - |
|
||||||
| text-size | 文字大小 | `String | Number` | `14px` | 2.0.0 |
|
| text-size | 文字大小 | `String | Number` | `14px` | 2.0.0 |
|
||||||
|
| vertical | 是否垂直排列图标和文字内容 | `Boolean` | `false` | 2.0.0 |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user