import { PropType } from 'vue'; import { TypeButtonProps } from './type'; export default { /** 是否为块级元素 */ block: Boolean, /** 按钮内容 */ content: { type: [String, Function] as PropType, }, /** 按钮内容 */ default: { type: [String, Function] as PropType, }, /** 是否禁用按钮 */ disabled: Boolean, /** 是否为幽灵按钮(镂空按钮) */ ghost: Boolean, /** 按钮内部图标,可完全自定义 */ icon: { type: Function as PropType, }, /** 是否显示为加载状态 */ loading: Boolean, /** 按钮形状,有 4 种:长方形、正方形、圆角长方形、圆形 */ shape: { type: String as PropType, default: 'rectangle' as TypeButtonProps['shape'], validator(val: TypeButtonProps['shape']): boolean { return ['rectangle', 'square', 'round', 'circle'].includes(val); }, }, /** 组件尺寸 */ size: { type: String as PropType, default: 'medium' as TypeButtonProps['size'], validator(val: TypeButtonProps['size']): boolean { return ['small', 'medium', 'large'].includes(val); }, }, /** 组件风格,依次为默认色、品牌色、危险色、警告色、成功色 */ theme: { type: String as PropType, default: undefined as TypeButtonProps['theme'], validator(val: TypeButtonProps['theme']): boolean { return ['default', 'primary', 'danger', 'warning', 'success'].includes(val); }, }, /** 按钮类型 */ type: { type: String as PropType, default: 'button' as TypeButtonProps['type'], validator(val: TypeButtonProps['type']): boolean { return ['submit', 'reset', 'button'].includes(val); }, }, /** 按钮形式,基础、线框、虚线、文字 */ variant: { type: String as PropType, default: 'base' as TypeButtonProps['variant'], validator(val: TypeButtonProps['variant']): boolean { return ['base', 'outline', 'dashed', 'text'].includes(val); }, }, /** 点击时触发 */ onClick: Function as PropType, };