Skip to content

Commit 33beb46

Browse files
authored
Add Iconify icon selector to FormKit docs (#527)
1 parent 99e82ae commit 33beb46

File tree

5 files changed

+59
-1
lines changed

5 files changed

+59
-1
lines changed

docs/developer-guide/form-schema.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,3 +584,46 @@ menuSelect 基于 select,并兼容 select 的[参数](#select-params)。
584584
label: 标签
585585
value: []
586586
```
587+
588+
### iconify
589+
590+
统一的图标选择器,基于 [Iconify](https://iconify.design/)。
591+
592+
示例
593+
594+
```yaml
595+
- $formkit: iconify
596+
name: social_icon
597+
label: 社交图标
598+
format: svg # svg / dataurl / url / name
599+
```
600+
601+
#### 参数
602+
603+
- `format`:图标格式
604+
- `svg`:svg 字符串
605+
- `dataurl`:base64 的图片链接,可以直接用于 img 标签
606+
- `url`:Iconify 的 CDN 链接
607+
- `name`:Iconify 的图标名称,需要在使用的地方自行加载图标
608+
609+
在主题模板中的使用示例:
610+
611+
```html
612+
<!-- 当 format 为 name 时,使用 Iconify 封装的 Web Component 加载图标 -->
613+
<script src="https://code.iconify.design/iconify-icon/3.0.0/iconify-icon.min.js"></script>
614+
<iconify-icon th:icon="${theme.config.group.social_icon}"></iconify-icon>
615+
616+
<!-- svg -->
617+
<th:block th:utext="${theme.config.group.social_icon}"></th:block>
618+
619+
<!-- dataurl 或者 url -->
620+
<img th:src="${theme.config.group.social_icon}" />
621+
```
622+
623+
开发者可根据具体使用情况自行选择图标格式,通常推荐 `svg` 或者 `dataurl`,因为这样无需任何网络请求,确保图标可以稳定地正常加载。
624+
625+
UI 效果:
626+
627+
<p>
628+
<img src="/img/formkit/formkit-iconify.png" width="50%" class="medium-zoom-image" />
629+
</p>

docs/developer-guide/plugin/api-changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ pnpm install @halo-dev/ui-shared
4545

4646
2. 提升 [plugin.yaml#spec.requires](./basics/manifest.md#字段详解) 版本为 `>=2.22.0`
4747
3. 按照[最新文档](./extension-points/ui/attachment-selector-create.md)修改插件代码
48+
49+
### 表单定义 > 新增 Iconify 图标选择器
50+
51+
在 2.22.0 中,我们为 FormKit 表单提供了通用的图标选择器,基于 [Iconify](https://icon-sets.iconify.design/),详细文档可查阅:[表单定义#Iconify](../../developer-guide/form-schema.md#iconify)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: API 变更日志
3+
description: 记录每一个版本的主题 API 变更记录,方便开发者适配
4+
---
5+
6+
## 2.22.0
7+
8+
### 表单定义 > 新增 Iconify 图标选择器
9+
10+
在 2.22.0 中,我们为 FormKit 表单提供了通用的图标选择器,基于 [Iconify](https://icon-sets.iconify.design/),详细文档可查阅:[表单定义#Iconify](../../developer-guide/form-schema.md#iconify)

sidebars.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ module.exports = {
340340
items: ["developer-guide/plugin/examples/todolist"],
341341
},
342342
// "developer-guide/plugin/appendices",
343-
"developer-guide/plugin/api-changelog"
343+
"developer-guide/plugin/api-changelog",
344344
],
345345
},
346346
{
@@ -401,6 +401,7 @@ module.exports = {
401401
"developer-guide/theme/global-variables",
402402
"developer-guide/theme/template-tag",
403403
"developer-guide/theme/code-snippets",
404+
"developer-guide/theme/api-changelog",
404405
],
405406
},
406407
{
81.3 KB
Loading

0 commit comments

Comments
 (0)