Schema

此章节介绍 Schema 下的相关属性

基础用法

Schema API

Schema Attributes

名称说明类型默认值必填
title字段名称String
type字段类型String
format格式化字段组件为相关展示组件String
description字段增强描述功能String
oneOf单选功能时的 Options 选项Array<EnumType>true
anyOf多选功能时的 Options 选项Array<EnumType>true
scale字段数值类型时,四舍五入位数Nubmer
minLength字段最小输入位数Nubmer
maxLength字段最大输入位数Nubmer

类型声明

显示类型声明
export declare type AllowScehmaTypeType =
  | 'string'
  | 'number'
  | 'index'
  | 'integer'

export declare type AllowSchemaFormatType =
  | 'currency' // type为 number 时可用
  | 'date' // type为string时可用
  | 'date-time' // type为string时可用
  | 'time' // type为string时可用
  | 'int32' // 暂未实现
  | 'int64' // 暂未实现
  | 'bigdecimal' //暂未实现

export declare type EnumType = {
  const?: any
  title?: any
  disabled?: boolean
}
export declare interface SchemaProperties {
  title: string
  type?: AllowScehmaTypeType
  format?: AllowSchemaFormatType
  description?: string
  oneOf?: Array<EnumType>
  anyOf?: Array<EnumType>
  scale?: number
  // pattern: RegExp | string
  minLength?: number
  maxLength?: number
}

export declare interface SchemaProps {
  required?: Array<string>
  properties: Record<string, SchemaProperties>
}

export declare interface SchemaUiProps {
  disabled?: boolean
  readonly?: boolean
  visible?: boolean
  colspan?: number
  options?: Record<string, any>
}

export declare interface SchemaUiPropsByTable extends SchemaUiProps {
  width?: number | string
  sortable?: boolean
  fixed?: VxeColumnPropTypes.Fixed
  formatter?: VxeColumnPropTypes.Formatter
  columnVisible?: boolean
  formItemVisible?: boolean
}