vxe-pc-ui
Version:
A vue based PC component library
38 lines (33 loc) • 878 B
text/typescript
import XEUtils from 'xe-utils'
import { VxeComponentSlotType } from '@vxe-ui/core'
export function getOnName (type: string) {
return 'on' + type.substring(0, 1).toLocaleUpperCase() + type.substring(1)
}
export function getModelEvent (name: string) {
switch (name) {
case 'input':
case 'textarea':
return 'input'
case 'select':
return 'change'
}
return 'update:modelValue'
}
export function getChangeEvent (name: string) {
switch (name) {
case 'input':
case 'textarea':
case 'VxeInput':
case 'VxeTextarea':
case '$input':// 已废弃
case '$textarea':// 已废弃
return 'input'
}
return 'change'
}
export function getSlotVNs (vns: VxeComponentSlotType | VxeComponentSlotType[] | undefined) {
if (XEUtils.isArray(vns)) {
return vns
}
return vns ? [vns] : []
}