docs: props title (#2314)

This commit is contained in:
neverland 2019-11-15 14:23:13 +08:00 committed by GitHub
parent f5c7050800
commit 07b502bc20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
# Skeleton
# Skeleton 骨架屏
### Install
### 引入
`app.json``index.json`中引入组件,详细介绍见[快速上手](#/quickstart#yin-ru-zu-jian)
```json
"usingComponents": {
@ -8,21 +10,27 @@
}
```
## Usage
## 代码演示
### Basic Usage
### 基础用法
通过`title`属性显示标题占位图,通过`row`属性配置占位段落行数
```html
<van-skeleton title row="3" />
```
### Show Avatar
### 显示头像
通过`avatar`属性显示头像占位图
```html
<van-skeleton title avatar row="3" />
```
### Show Children
### 展示子组件
`loading`属性设置成`false`表示内容加载完成,此时会隐藏占位图,并显示`Skeleton`的子组件
```html
<van-skeleton
@ -31,7 +39,7 @@
row="3"
loading="loading"
>
<div>Content</div>
<view>实际内容</view>
</van-skeleton>
```
@ -40,8 +48,7 @@ Page({
data: {
loading: true
},
onChange() {
onReady() {
this.setData({
loading: false
});
@ -53,14 +60,16 @@ Page({
### Props
| Attribute | Description | Type | Default | Version |
### Props
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|------|------|------|------|------|
| row | Row count | *number* | `0` | - |
| row-width | Row width, can be array | *string \| string[]* | `100%` | - |
| title | Whether to show title placeholder | *boolean* | `false` | - |
| title-width | Title width | string | `40%` | - |
| avatar | Whether to show avatar placeholder | *boolean* | `false` | - |
| avatar-size | Size of avatar placeholder | string | `32px` | - |
| avatar-shape | Shape of avatar placeholdercan be set to `square` | *string* | `round` | - |
| loading | Whether to show skeletonpass `false` to show child component | *boolean* | `true` | - |
| animate | Whether to enable animation | *boolean* | `true` | - |
| row | 段落占位图行数 | *number* | `0` | - |
| row-width | 段落占位图宽度,可传数组来设置每一行的宽度 | *string \| string[]* | `100%` | - |
| title | 是否显示标题占位图 | *boolean* | `false` | - |
| title-width | 标题占位图宽度 | *string \| number* | `40%` | - |
| avatar | 是否显示头像占位图 | *boolean* | `false` | - |
| avatar-size | 头像占位图大小 | *string \| number* | `32px` | - |
| avatar-shape | 头像占位图形状,可选值为`square` | *string* | `round` | - |
| loading | 是否显示占位图,传`false`时会展示子组件内容 | *boolean* | `true` | - |
| animate | 是否开启动画 | *boolean* | `true` | - |