Skip to content

Commit 9beee9b

Browse files
committed
docs: 文档更新
1 parent 747f504 commit 9beee9b

File tree

4 files changed

+53
-3
lines changed

4 files changed

+53
-3
lines changed

README.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
- [x] 🍕 TypeScript
2929
- [x] ✨ Vant4 组件库
3030
- [x] 🌀 Tailwindcss 原子类框架
31+
- [x] 👏 集成多种图标方案
3132
- [x] 🍍 Pinia 状态管理
3233
- [x] 🌓 支持深色模式
3334
- [x] 🧀 支持 i18n
3435
- [x] Vue-router 4
35-
- [x] 支持 SVG 图标自动注册组件
3636
- [x] vmin 视口适配
3737
- [x] Axios 封装
3838
- [x] 打包资源 gzip 压缩
@@ -103,7 +103,7 @@ cd vue3-h5-template
103103
## 文档引导
104104

105105
> - [按需引入 vant 组件](#vant)
106-
> - [SVG 图标使用](#svg)
106+
> - [图标使用](#icon)
107107
> - [路由缓存 & 命名注意 ⚠](#router)
108108
> - [调试面板 eruda](#console)
109109
> - [动态设置页面标题](#page-title)
@@ -120,7 +120,57 @@ cd vue3-h5-template
120120

121121

122122

123-
### - <span id="svg">SVG 图标使用</span>
123+
### - <span id="icon">图标使用</span>
124+
125+
**Iconify 图标(推荐)**
126+
127+
Iconify 拥有图标数量超过 20 万的图标库,同时文档比较友好,本项目基于 `Iconify for Vue` 稍微进行了封装。
128+
129+
使用方法 ⑴:
130+
131+
![Snipaste_2024-06-27_00-00-17](/Users/tiga/Desktop/code/vue3-h5-template/docs/assets/img/Snipaste_2024-06-27_00-00-17.png)
132+
133+
基于 Iconify [图标集网站](https://icon-sets.iconify.design/)获取到你想要的图标名称后填入 `i-icon` 组件的 `icon` 属性即可。
134+
135+
```vue
136+
<i-icon icon="fa6-solid:heart" />
137+
```
138+
139+
配合 VS Code [编辑器扩展](https://marketplace.visualstudio.com/items?itemName=antfu.iconify)可在编码时实时预览图标!
140+
141+
![Snipaste_2024-06-27_00-43-17](/Users/tiga/Desktop/code/vue3-h5-template/docs/assets/img/Snipaste_2024-06-27_00-44-55.png)
142+
143+
注意,方法 ⑴ 是通过 Iconify API 按需请求获取图标,如果你的项目仅在内网环境部署,可通过👇🏻方法 ⑵ 离线使用图标。
144+
145+
使用方法 ⑵ :
146+
147+
基于 Iconify [图标集网站](https://icon-sets.iconify.design/)搜索到你想要的图标,安装图标对应的图标集依赖包。
148+
149+
```shell
150+
pnpm i -D @iconify-icons/fa6-solid
151+
```
152+
153+
*依赖包名规则:@iconify-icons/[图标集]*
154+
155+
![Snipaste_2024-06-27_00-07-10](/Users/tiga/Desktop/code/vue3-h5-template/docs/assets/img/Snipaste_2024-06-27_00-07-10.png)
156+
157+
引入你想要的图标 data,赋值给 `i-icon` 组件的 `icon` 属性即可。
158+
159+
*图标路径规则:@iconify-icons/[图标集]/[图标名]*
160+
161+
```ts
162+
import Fa6SolidHeart from "@iconify-icons/fa6-solid/heart";
163+
```
164+
165+
```vue
166+
<i-icon :icon="Fa6SolidHeart" />
167+
```
168+
169+
案例代码可参考本项目的 `tools` [页面](https://github.com/yulimchen/vue3-h5-template/blob/master/src/views/tools/index.vue),想对强大的 Iconify 了解更多?请戳 👉 https://iconify.design/docs/
170+
171+
172+
173+
② 本地 SVG 文件图标
124174

125175

126176
> 1. 将 svg 图标文件放在 `src/icons/svg` 目录下
Loading
Loading
41.2 KB
Loading

0 commit comments

Comments
 (0)