docs(Icon): add demo and docs (#2498)

This commit is contained in:
Dottieworks 2019-12-09 13:57:07 +08:00 committed by neverland
parent b5ecc922a3
commit cc48c40547
3 changed files with 119 additions and 1 deletions

View File

@ -4,7 +4,8 @@ import Page from '../../common/page';
Page({
data: {
icons,
active: 0
active: 0,
demoIcon: 'location-o'
},
onSwitch(event) {

View File

@ -48,4 +48,105 @@
<view class="text">{{ item }}</view>
</van-col>
</van-tab>
<van-tab title="用法示例" custom-class="demo-tab-pane">
<demo-block title="图标右上角小红点">
<van-col
custom-class="col"
span="6"
>
<van-icon
name="{{ demoIcon }}"
size="32px"
custom-class="icon"
/>
<view class="text">{{ demoIcon }}</view>
</van-col>
<van-col
custom-class="col"
span="6"
>
<van-icon
name="{{ demoIcon }}"
size="32px"
custom-class="icon"
dot
/>
<view class="text">{{ demoIcon }}</view>
</van-col>
</demo-block>
<demo-block title="图标右上角文字提示">
<van-col
custom-class="col"
span="6"
>
<van-icon
name="{{ demoIcon }}"
size="32px"
custom-class="icon"
/>
<view class="text">{{ demoIcon }}</view>
</van-col>
<van-col
custom-class="col"
span="6"
>
<van-icon
name="{{ demoIcon }}"
size="32px"
custom-class="icon"
info="99+"
/>
<view class="text">{{ demoIcon }}</view>
</van-col>
</demo-block>
<demo-block title="图标颜色">
<van-col
custom-class="col"
span="6"
>
<van-icon
name="{{ demoIcon }}"
size="32px"
custom-class="icon"
/>
<view class="text">{{ demoIcon }}</view>
</van-col>
<van-col
custom-class="col"
span="6"
>
<van-icon
name="{{ demoIcon }}"
size="32px"
custom-class="icon"
color="red"
/>
<view class="text">{{ demoIcon }}</view>
</van-col>
</demo-block>
<demo-block title="图标大小">
<van-col
custom-class="col"
span="6"
>
<van-icon
name="{{ demoIcon }}"
size="32px"
custom-class="icon"
/>
<view class="text">{{ demoIcon }}</view>
</van-col>
<van-col
custom-class="col"
span="6"
>
<van-icon
name="{{ demoIcon }}"
size="45px"
custom-class="icon"
/>
<view class="text">{{ demoIcon }}</view>
</van-col>
</demo-block>
</van-tab>
</van-tabs>

View File

@ -35,6 +35,22 @@
<van-icon name="chat" info="99+" />
```
### 图标颜色
设置`color`属性来控制图标颜色
```html
<van-icon name="chat" color="red" />
```
### 图标大小
设置`size`属性来控制图标大小
```html
<van-icon name="chat" size="50px" />
```
## API
### Props