table-props.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. export const tableProps = {
  2. data: { // table的数据
  3. type: Array,
  4. default: () => []
  5. },
  6. size: { type: String, validate: (val) => ['medium', 'small', 'mini'].includes(val) },
  7. columns: { type: Array, default: () => [] }, // table 数据列的配置
  8. offset: Number, // table第一行数据的偏移量, 设置该值将在左侧添加一个序号列
  9. hideIndex: Boolean, // 补充控制序号列,优先级高于offset,即当offset存在但hideIndex为true时依然不渲染序号列
  10. indexFixed: Boolean, // 序号列左侧悬浮
  11. height: String, // table的高度 可使用css的calc方法
  12. selectType: { // table 是否可以选择
  13. type: String,
  14. validate: (val) => ['checkbox', 'radio'].includes(val)
  15. },
  16. selectable: Function, // table 是否可复选 需要与selectType = checkbox 配合使用 function(row,index)
  17. selectRadio: [String, Number], // table为单选时的选中列的value
  18. selectLabel: String, // table为单选时的选中列的展示值
  19. selectColumns: Array, // ERROR ?? 似乎没什么用
  20. tableHeaderLabel: String, // table所有列是否添加一个父title
  21. inForm: Boolean, // 是否为表单的输入或展示
  22. rowKey: [String, Function], // 每一行的唯一主键 可为空 [建议写]
  23. treeProps: { // 树形table的配置 { children: 'children', hasChildren: 'hasChildren' }
  24. type: Object,
  25. default: () => ({})
  26. },
  27. defaultExpendAll: Boolean,
  28. withTableHandle: Boolean, // 是否需要自带的处理列
  29. handlerWidth: { // 自带的处理列的宽度
  30. type: String,
  31. default: '120px'
  32. },
  33. handlerLimit: { type: Number, default: 3 },
  34. fieldKey: String, // form下使用时的data所在的键值
  35. ruleKey: String, // form下当前data的检验规则key, 此处为空时使用fieldKey
  36. dependOnValues: Object // form 下对外部数据的依赖
  37. }