icon.md 2.3 KB
Newer Older
M
mehaotian 已提交
1 2 3 4 5 6
#### icon

图标。

**平台差异说明**

雪洛's avatar
雪洛 已提交
7
|App|H5|微信小程序|支付宝小程序|百度小程序|头条小程序|QQ小程序|
8
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
W
wanganxp 已提交
9
|√|√(2.2.3+)|√|√|√|√|√|
10 11

**Tips**
M
mehaotian 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

* 由于 icon 组件各端表现存在差异,可以通过使用 [字体图标](/frame?id=字体图标) 的方式来弥补各端差异。

**属性说明**

|属性名|类型|默认值|说明|
|---|---|---|---|
|type|String||icon的类型|
|size|Number|23|icon的大小,单位px|
|color|Color||icon的颜色,同css的color|

各平台 type 有效值说明:

|平台|type 有效值|
|:-:|:-:|
雪洛's avatar
雪洛 已提交
27
|App、H5、微信小程序、QQ小程序|success, success_no_circle, info, warn, waiting, cancel, download, search, clear|
M
mehaotian 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|支付宝小程序|info, warn, waiting, cancel, download, search, clear, success, success_no_circle,loading|
|百度小程序|success, info, warn, waiting, success_no_circle, clear, search, personal, setting, top, close, cancel, download, checkboxSelected, radioSelected, radioUnselect|


**示例**
```html
<view class="item" v-for="(value,index) in iconType" :key="index">
    <icon :type="value" size="26"/>
    <text>{{value}}</text>
</view>
```
```javascript
export default {
    data() {
        return {
            iconType: ['success']
        }
    },
    onLoad() {
        // #ifdef APP-PLUS|| MP-WEIXIN
        this.iconType = ['success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search','clear']
        // #endif
        // #ifdef MP-ALIPAY
        this.iconType = ['info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear', 'success', 'success_no_circle', 'loading']
        // #endif
        // #ifdef MP-BAIDU
        this.iconType = ['success', 'info', 'warn', 'waiting', 'success_no_circle', 'clear', 'search', 'personal', 'setting', 'top', 'close', 'cancel', 'download', 'checkboxSelected', 'radioSelected', 'radioUnselect']
        // #endif
    }
}

```

**效果展示**

<div style="display:flex;align-items: flex-start;justify-content: center;flex-wrap: wrap;">
		<img src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/doc/icon1.png" width="375" style="margin-right:20px;"/>
		<img src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/doc/icon2.png" width="375"/>
</div>