Files
mes-ui-d2/docs/zh/components/icon-svg.md
liyang 0a6197af96 no message
Former-commit-id: 5687d48500127f5179c5df5f44c145a424ab8685 [formerly 5687d48500127f5179c5df5f44c145a424ab8685 [formerly 5687d48500127f5179c5df5f44c145a424ab8685 [formerly 5687d48500127f5179c5df5f44c145a424ab8685 [formerly deb8efa876d93a0165de65ce1aced033188a937b [formerly 8e82e9a1dcbd7aa23397bfd876f3d3cab340508e]]]]]
Former-commit-id: 6d53503b8dbcdc069888df0fec05e61ccff5573d
Former-commit-id: 2bbcccac95df7dbfe0462cadc284453c4e44700a
Former-commit-id: 7f7989dac21939e8b801e787a568926388de5e90 [formerly 1b8dfb3c382ffe2597804e302960f2c75b0cf438]
Former-commit-id: e58dc76303156f64e75360dc6ca3d0d819d440fd
Former-commit-id: 9a5dd96415bea1023d6c7959da1905d46f7151e5
Former-commit-id: da456b5bb83a3073e6d56104bbf6ee23b98d289c
Former-commit-id: afbddff8fc88b51bcef2a0e2001842a8cdf502e2
Former-commit-id: 5026ae150e2d62fb5eb939b34cab754fb96aca3f
2018-07-01 22:58:01 +08:00

34 lines
1.1 KiB
Markdown
Raw 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.

# 图标 - SVG
## 参数
| 参数名 | 介绍 | 必选 | 值类型 | 可选值 | 默认值 |
| --- | --- | --- | --- | --- | --- |
| name | 图标名称 | 非 | String | src/assets/icons/svg 中 .svg 文件名 | 空 |
## 使用方法
首先将下载的 .svg 图标放入 `src/assets/icons/svg` 文件夹下
然后使用组件
``` vue
<d2-icon-svg name="刚才的svg文件名"/>
```
## 获取已经注册的所有图标
你已经发现了,只需要将图标文件放入项目中就会自动注册
这是因为已经对 `webpack` 和 `svg-sprite-loader` 进行了相关设置,`src/assets/icons/svg` 文件夹中的图标会自动注册到项目中,文件全部打包成 svg-sprite名称注册到 `Vue.$IconSvg` 属性中
所以如果你需要检查项目中已经注册的所有图标,可以通过如下方式
``` vue
// 在 vue 单文件组件中
console.log(this.$IconSvg)
```
## 参考
演示图标来源 [iconfont.cn @龙正昆《常用的50个4px双色图标库》](http://iconfont.cn/collections/detail?spm=a313x.7781069.1998910419.d9df05512&cid=4878)