vant/packages/icon/en-US.md
2019-03-17 18:48:18 +08:00

72 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Icon
### Install
``` javascript
import { Icon } from 'vant';
Vue.use(Icon);
```
### Usage
#### Basic Usage
Use `name` prop to set icon name or icon URL
```html
<van-icon name="close" />
<van-icon name="https://b.yzcdn.cn/vant/icon-demo-1126.png" />
```
#### Show Info
```html
<van-icon name="chat" info="9" />
<van-icon name="chat" info="99+" />
```
#### Use local font file
Icon uses font file in `yzcdn.cn` by defaultif you want to use the local font fileplease import the following css file.
```js
import 'vant/lib/icon/local.css';
```
#### Add custom iconfont
```css
@font-face {
font-family: 'my-icon';
src: url('./my-icon.ttf') format('truetype');
}
.my-icon {
font-family: 'my-icon';
}
.my-icon-extra::before {
content: '\e626';
}
```
```html
<van-icon class-prefix="my-icon" name="extra" />
```
### API
| Attribute | Description | Type | Default |
|------|------|------|------|
| name | Icon name or URL | `String` | `''` |
| info | Info message | `String | Number` | `''` |
| color | Icon color | `String` | `inherit` |
| size | Icon size | `String` | `inherit` |
| class-prefix | ClassName prefix | `String` | `van-icon` |
| tag | HTML Tag | `String` | `i` |
### Event
| Event | Description | Arguments |
|------|------|------|
| click | Triggered when click icon | - |