Pre Merge pull request !40 from pepsi_zheng/master
commit
d523f72a58
|
@ -65,7 +65,7 @@
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": false,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": "explicit",
|
"source.fixAll": "explicit",
|
||||||
"source.organizeImports": "never"
|
"source.organizeImports": false
|
||||||
},
|
},
|
||||||
"eslint.rules.customizations": [
|
"eslint.rules.customizations": [
|
||||||
{ "rule": "style/*", "severity": "off" },
|
{ "rule": "style/*", "severity": "off" },
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type { Rule as ValidationRule } from 'ant-design-vue/lib/form'
|
||||||
import { Col, Divider, Form } from 'ant-design-vue'
|
import { Col, Divider, Form } from 'ant-design-vue'
|
||||||
import { cloneDeep, upperFirst } from 'lodash-es'
|
import { cloneDeep, upperFirst } from 'lodash-es'
|
||||||
import type { FormActionType, FormProps, FormSchemaInner as FormSchema } from '../types/form'
|
import type { FormActionType, FormProps, FormSchemaInner as FormSchema } from '../types/form'
|
||||||
import { isComponentFormSchema } from '../types/form'
|
import { isComponentFormSchema, InputAttribute } from '../types/form'
|
||||||
import { componentMap } from '../componentMap'
|
import { componentMap } from '../componentMap'
|
||||||
import { NO_AUTO_LINK_COMPONENTS, createPlaceholderMessage, setComponentRuleType } from '../helper'
|
import { NO_AUTO_LINK_COMPONENTS, createPlaceholderMessage, setComponentRuleType } from '../helper'
|
||||||
import { useItemLabelWidth } from '../hooks/useLabelWidth'
|
import { useItemLabelWidth } from '../hooks/useLabelWidth'
|
||||||
|
@ -255,6 +255,18 @@ export default defineComponent({
|
||||||
|
|
||||||
const eventKey = `on${upperFirst(changeEvent)}`
|
const eventKey = `on${upperFirst(changeEvent)}`
|
||||||
|
|
||||||
|
// Input/InputTextArea输入限制
|
||||||
|
const inputAttr: InputAttribute = {}
|
||||||
|
if (component && ['Input', 'InputTextArea'.includes(component)]) {
|
||||||
|
const { maxlength, showCount } = props.schema
|
||||||
|
if (maxlength) {
|
||||||
|
inputAttr.maxlength = maxlength
|
||||||
|
}
|
||||||
|
if (showCount) {
|
||||||
|
inputAttr.showCount = showCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const { autoSetPlaceHolder, size } = props.formProps
|
const { autoSetPlaceHolder, size } = props.formProps
|
||||||
const propsData: Recordable<any> = {
|
const propsData: Recordable<any> = {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
|
@ -293,6 +305,7 @@ export default defineComponent({
|
||||||
...propsData,
|
...propsData,
|
||||||
...on,
|
...on,
|
||||||
...bindValue,
|
...bindValue,
|
||||||
|
...inputAttr
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!renderComponentContent)
|
if (!renderComponentContent)
|
||||||
|
|
|
@ -189,6 +189,12 @@ interface BaseFormSchema {
|
||||||
|
|
||||||
isAdvanced?: boolean
|
isAdvanced?: boolean
|
||||||
|
|
||||||
|
// Input/InputTextArea是否显示字数
|
||||||
|
showCount?: boolean
|
||||||
|
|
||||||
|
// Input/InputTextArea是否字限制长度
|
||||||
|
maxlength?: number
|
||||||
|
|
||||||
// Matching details components
|
// Matching details components
|
||||||
span?: number
|
span?: number
|
||||||
|
|
||||||
|
@ -258,3 +264,10 @@ export interface HelpComponentProps {
|
||||||
// Positioning
|
// Positioning
|
||||||
position: any
|
position: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface InputAttribute {
|
||||||
|
// 输入框默认输入的最大长度
|
||||||
|
maxlength?: number
|
||||||
|
// 是否显示输入的最大长度
|
||||||
|
showCount?: boolean
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue