refactor(GiForm): 优化表单组件的字数限制逻辑

- 修改了 GiForm 组件中 getComponentBindProps 方法,根据 props.search 的值决定是否显示字数限制
- 移除了 User 组件中冗余的 showWordLimit属性
This commit is contained in:
2025-03-18 20:51:27 +08:00
parent f0ba88eb54
commit 348c497876
2 changed files with 3 additions and 4 deletions

View File

@@ -142,10 +142,10 @@ const dicData: Record<string, any> = reactive({})
const getComponentBindProps = (item: ColumnItem) => {
// 组件默认配置映射表
const ConfigMap = new Map<ColumnItem['type'], Partial<ColumnItem['props'] & { placeholder: string }>>([
['input', { allowClear: true, placeholder: `请输入${item.label}`, maxLength: 255, showWordLimit: true }],
['input-password', { placeholder: `请输入${item.label}` }],
['input', { allowClear: true, placeholder: `请输入${item.label}`, maxLength: 255, showWordLimit: !props.search }],
['input-password', { placeholder: `请输入${item.label}`, showWordLimit: !props.search }],
['input-number', { placeholder: `请输入${item.label}` }],
['textarea', { allowClear: false, placeholder: `请输入${item.label}`, maxLength: 200, showWordLimit: true, autoSize: { minRows: 3, maxRows: 5 } }],
['textarea', { allowClear: false, placeholder: `请输入${item.label}`, maxLength: 200, showWordLimit: !props.search, autoSize: { minRows: 3, maxRows: 5 } }],
['input-tag', { allowClear: true, placeholder: `请输入${item.label}` }],
['mention', { allowClear: true, placeholder: `请输入${item.label}` }],
['select', { allowClear: true, placeholder: `请选择${item.label}`, options: dicData[item.field] || [] }],

View File

@@ -119,7 +119,6 @@ const queryFormColumns: ColumnItem[] = reactive([
},
props: {
placeholder: '搜索用户名/昵称/描述',
showWordLimit: false,
},
},
{