props.ts 665 字节
Newer Older
1
const validColors = ['primary', 'error', 'warning', 'success', ''] as const;
V
vben 已提交
2
type ButtonColorType = (typeof validColors)[number];
3

无木 已提交
4
export const buttonProps = {
5 6 7 8 9
  color: {
    type: String as PropType<ButtonColorType>,
    validator: (v) => validColors.includes(v),
    default: '',
  },
无木 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
  loading: { type: Boolean },
  disabled: { type: Boolean },
  /**
   * Text before icon.
   */
  preIcon: { type: String },
  /**
   * Text after icon.
   */
  postIcon: { type: String },
  /**
   * preIcon and postIcon icon size.
   * @default: 14
   */
  iconSize: { type: Number, default: 14 },
  onClick: { type: Function as PropType<(...args) => any>, default: null },
};