[Improvement] Icon: add class-prefix (#1688)

This commit is contained in:
neverland 2018-08-24 20:23:07 +08:00 committed by GitHub
parent 8052125d00
commit 873a2438b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -52,6 +52,7 @@ import 'vant/lib/vant-css/icon-local.css';
| info | Info message | `String | Number` | `''` |
| color | Icon color | `String` | `inherit` |
| size | Icon size | `String` | `inherit` |
| class-prefix | ClassName prefix | `String` | `van-icon` |
### Event

View File

@ -1,5 +1,5 @@
<template>
<i :class="[b(), `van-icon-${name}`]" :style="style" v-on="$listeners">
<i :class="[classPrefix, `${classPrefix}-${name}`]" :style="style" v-on="$listeners">
<slot />
<div v-if="isDef(info)" :class="b('info')">{{ info }}</div>
</i>
@ -15,7 +15,11 @@ export default create({
name: String,
info: [String, Number],
color: String,
size: String
size: String,
classPrefix: {
type: String,
default: 'van-icon'
}
},
computed: {

View File

@ -56,6 +56,7 @@ import 'vant/lib/vant-css/icon-local.css';
| info | 图标右上角文字提示 | `String | Number` | - |
| color | 图标颜色 | `String` | `inherit` |
| size | 图标大小,如 `20px``2em` | `String` | `inherit` |
| class-prefix | 类名前缀 | `String` | `van-icon` |
### Event