table-props.js 1.9 KB

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