Skip to content

Commit

Permalink
style: formDemo集成图标选择器
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Sep 27, 2023
1 parent 7c93b74 commit 99ffe6a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/components/Form/src/helper/componentMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import { InputPassword } from '@/components/InputPassword'
import { Editor } from '@/components/Editor'
import { JsonEditor } from '@/components/JsonEditor'
import { IconPicker } from '@/components/IconPicker'
import { ComponentName } from '../types'

const componentMap: Recordable<Component, ComponentName> = {
Expand All @@ -49,7 +50,8 @@ const componentMap: Recordable<Component, ComponentName> = {
Editor: Editor,
TreeSelect: ElTreeSelect,
Upload: ElUpload,
JsonEditor: JsonEditor
JsonEditor: JsonEditor,
IconPicker: IconPicker
}

export { componentMap }
3 changes: 2 additions & 1 deletion src/components/Form/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export enum ComponentNameEnum {
EDITOR = 'Editor',
TREE_SELECT = 'TreeSelect',
UPLOAD = 'Upload',
JSON_EDITOR = 'JsonEditor'
JSON_EDITOR = 'JsonEditor',
ICON_PICKER = 'IconPicker'
}

type CamelCaseComponentName = keyof typeof ComponentNameEnum extends infer K
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ export default {
lazyLoad: 'Lazy load',
upload: 'Upload',
// 用户头像
userAvatar: 'User avatar'
userAvatar: 'User avatar',
iconPicker: 'Icon picker'
},
guideDemo: {
guide: 'Guide',
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ export default {
customContent: '自定义内容',
lazyLoad: '懒加载',
upload: '上传',
userAvatar: '用户头像'
userAvatar: '用户头像',
iconPicker: '图标选择器'
},
guideDemo: {
guide: '引导页',
Expand Down
11 changes: 11 additions & 0 deletions src/views/Components/Form/DefaultForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,17 @@ const schema = reactive<FormSchema[]>([
a: 1,
b: 2
}
},
{
field: 'field87',
component: 'Divider',
label: t('formDemo.iconPicker')
},
{
field: 'field88',
component: 'IconPicker',
label: t('formDemo.default'),
value: 'tdesign:archway'
}
])
</script>
Expand Down

0 comments on commit 99ffe6a

Please sign in to comment.