import type { ExtractPropTypes, PropType, StyleValue } from 'vue' export const unknownProp = null as unknown as PropType export const numericProp = [Number, String] export const truthProp = { type: Boolean, default: true as const } export const nullableBooleanProp = { type: Boolean as PropType, default: undefined } export const makeRequiredProp = (type: T) => ({ type, required: true as const }) export const makeArrayProp = (defaultVal: T[] = []) => ({ type: Array as PropType, default: () => defaultVal }) export const makeObjectProp = (defaultVal: T) => ({ type: Object as PropType, default: () => defaultVal }) export const makeBooleanProp = (defaultVal: T) => ({ type: Boolean, default: defaultVal }) export const makeNumberProp = (defaultVal: T) => ({ type: Number, default: defaultVal }) export const makeNumericProp = (defaultVal: T) => ({ type: numericProp, default: defaultVal }) export const makeStringProp = (defaultVal: T) => ({ type: String as unknown as PropType, default: defaultVal }) export type ClassType = string | object | Array export const baseProps = { /** * 自定义根节点样式 */ customStyle: { type: [String, Object, Array] as PropType, default: '' }, /** * 自定义根节点样式类 */ customClass: { type: [String, Object, Array] as PropType, default: '' } } export type BaseProps = ExtractPropTypes