mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] Icon: add class-prefix (#1688)
This commit is contained in:
parent
8052125d00
commit
873a2438b0
@ -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
|
||||
|
@ -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: {
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user