fix: form inputnumber

This commit is contained in:
xingyu4j 2022-11-17 13:27:26 +08:00
parent f606bfb12b
commit 08656ee070
4 changed files with 11 additions and 10 deletions

View File

@ -227,9 +227,13 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => {
if (schemaItem?.isForm !== false || schemaItem?.form?.show == true) { if (schemaItem?.isForm !== false || schemaItem?.form?.show == true) {
// 默认为 input // 默认为 input
let component = schemaItem?.form?.component || 'Input' let component = schemaItem?.form?.component || 'Input'
const options: ComponentOptions[] = [] let defaultValue: any = ''
if (component === 'InputNumber') {
defaultValue = 0
}
let comonentProps = {} let comonentProps = {}
if (schemaItem.dictType) { if (schemaItem.dictType) {
const options: ComponentOptions[] = []
if (schemaItem.dictData && schemaItem.dictData === 'number') { if (schemaItem.dictData && schemaItem.dictData === 'number') {
getIntDictOptions(schemaItem.dictType).forEach((dict) => { getIntDictOptions(schemaItem.dictType).forEach((dict) => {
options.push(dict) options.push(dict)
@ -253,7 +257,8 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => {
field: schemaItem.field, field: schemaItem.field,
label: schemaItem.form?.label || schemaItem.title, label: schemaItem.form?.label || schemaItem.title,
component: component, component: component,
componentProps: comonentProps componentProps: comonentProps,
value: defaultValue
} }
formSchema.push(formSchemaItem) formSchema.push(formSchemaItem)

View File

@ -49,8 +49,7 @@ export const modelSchema = reactive<FormSchema[]>([
{ {
label: '显示排序', label: '显示排序',
field: 'sort', field: 'sort',
component: 'InputNumber', component: 'InputNumber'
value: 0
}, },
{ {
label: '状态', label: '状态',

View File

@ -52,8 +52,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '访问令牌的有效期', title: '访问令牌的有效期',
field: 'accessTokenValiditySeconds', field: 'accessTokenValiditySeconds',
form: { form: {
component: 'InputNumber', component: 'InputNumber'
value: 0
}, },
table: { table: {
slots: { slots: {
@ -65,8 +64,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '刷新令牌的有效期', title: '刷新令牌的有效期',
field: 'refreshTokenValiditySeconds', field: 'refreshTokenValiditySeconds',
form: { form: {
component: 'InputNumber', component: 'InputNumber'
value: 0
}, },
table: { table: {
slots: { slots: {

View File

@ -82,8 +82,7 @@ const crudSchemas = reactive<CrudSchema[]>([
label: '账号额度', label: '账号额度',
field: 'accountCount', field: 'accountCount',
form: { form: {
component: 'InputNumber', component: 'InputNumber'
value: 0
} }
}, },
{ {