veui
Version:
Baidu Enterprise UI for Vue.js.
52 lines (44 loc) • 1.11 kB
TypeScript
import { VeuiDefineComponent, VeuiDefineInstance, UiMixin } from '../common'
type RuleItem = {
name: string
priority?: number
triggers?: string
value?: unknown
message?: string | ((ruleValue: unknown, value: unknown) => string)
}
type Props = {
/**
* 字段名称,一般可以传递在 `data` 中的路径,而忽略 `field`
*/
name: string
/**
* 字段在 `data` 中的路径,一般和 `name` 不同时才需要传递
*/
field?: string
label?: string
tip?: string
disabled?: boolean
readonly?: boolean
/**
* 用来在没有 required rule 的字段上加上必填样式
*/
required?: boolean
rules?: string | Array<string | RuleItem>
help?: string
helpPosition?: 'bottom' | 'side' | 'top'
abstract?: boolean
withholdValidity?: boolean
validityDisplay?: 'normal' | 'simple'
}
type Emits = {}
type Mixins = UiMixin
type Slots = {
default(): unknown
label(): unknown
tip(): unknown
help(): unknown
}
type Field = VeuiDefineComponent<{
new (...args: any[]): VeuiDefineInstance<Props, Emits, Slots, Mixins>
}>
export default Field