Merge branch 'dev' of github.com:youzan/vant into dev

This commit is contained in:
niunai 2018-03-22 16:39:56 +08:00
commit 84019a2608
2 changed files with 42 additions and 0 deletions

View File

@ -23,6 +23,27 @@ Icon uses font file in `yzcdn.cn` by defaultif you want to use the local font
import 'vant/lib/vant-css/icon-local.css'; import 'vant/lib/vant-css/icon-local.css';
``` ```
#### Add custom iconfont
```css
@font-face {
font-family: 'custom-iconfont';
src: url('./iconfont.ttf') format('truetype');
}
.van-icon {
font-family: 'vant-icon', 'custom-iconfont' !important;
}
.van-icon-extra:before {
content: '\e626';
}
```
```html
<van-icon name="extra" />
```
### API ### API
| Attribute | Description | Type | Default | Accepted Values | | Attribute | Description | Type | Default | Accepted Values |

View File

@ -23,6 +23,27 @@ Icon 组件默认引用 `yzcdn.cn` 域名下的字体文件,如果想要使用
import 'vant/lib/vant-css/icon-local.css'; import 'vant/lib/vant-css/icon-local.css';
``` ```
#### 自定义图标
如果需要在现有 Icon 的基础上使用更多图标,可以引入你需要的 iconfont 对应的 ttf 文件和样式,之后就可以在 Icon 组件中直接使用
```css
@font-face {
font-family: 'custom-iconfont';
src: url('./iconfont.ttf') format('truetype');
}
.van-icon {
font-family: 'vant-icon', 'custom-iconfont' !important;
}
.van-icon-extra:before {
content: '\e626';
}
```
```html
<van-icon name="extra" />
```
### API ### API