Ryan Wang
|
d441e4731e
|
feat: add accepts and min,max props for attachment selector modal component (#3827)
#### What type of PR is this?
/kind feature
/area console
/milestone 2.5.x
#### What this PR does / why we need it:
附件选择组件(AttachmentSelectorModal)支持 accepts、min、max 参数用来限定文件格式和数量。同时也为 FormKit 的 attachment 类型添加同样的参数。
另外,Console 的部分表单也跟着做了修改,包括:文章/页面设置中的封面图、系统设置中的 Favicon 和 Logo、分类/标签编辑表单中的封面图、用户资料的头像。
FormKit 中使用:
1. Component
```vue
<FormKit
name="cover"
type="attachment"
:accepts="['image/*']"
></FormKit>
```
2. Schema
```yaml
- $formkit: attachment
name: cover
accepts:
- 'image/*'
```
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3800
#### Special notes for your reviewer:
测试方式:
1. 按照上述 FormKit 中的使用方式,自行在主题或者插件配置文件中测试。
2. 测试 Console 中修改的表单:文章/页面设置中的封面图、系统设置中的 Favicon 和 Logo、分类/标签编辑表单中的封面图、用户资料的头像。(均设置为仅允许选择图片(image/*)和最多选择一个(max=1))。
#### Does this PR introduce a user-facing change?
```release-note
Console 端的附件选择组件支持 accepts、min、max 参数用来限定文件格式和数量。
```
|
2023-04-24 07:45:44 +00:00 |