Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="u-table" :style="[tableStyle]">
  3. <slot />
  4. </view>
  5. </template>
  6. <script>
  7. /**
  8. * table 表格
  9. * @description 表格组件一般用于展示大量结构化数据的场景
  10. * @tutorial https://www.uviewui.com/components/table.html
  11. * @property {String} border-color 表格边框的颜色(默认#e4e7ed)
  12. * @property {String} bg-color 表格的背景颜色(默认#ffffff)
  13. * @property {String} align 单元格的内容对齐方式,作用类似css的text-align(默认center)
  14. * @property {String} padding 单元格的内边距,同css的padding写法(默认10rpx 0)
  15. * @property {String Number} font-size 单元格字体大小,单位rpx(默认28)
  16. * @property {String} color 单元格字体颜色(默认#606266)
  17. * @property {Object} th-style th单元格的样式,对象形式(将th所需参数放在table组件,是为了避免每一个th组件要写一遍)
  18. * @event {Function} click 点击组件时触发
  19. * @event {Function} close 点击关闭按钮时触发
  20. * @example <u-table></u-table>
  21. */
  22. export default {
  23. name: "u-table",
  24. emits: ["click", "close"],
  25. props: {
  26. borderColor: {
  27. type: String,
  28. default: '#e4e7ed'
  29. },
  30. align: {
  31. type: String,
  32. default: 'center'
  33. },
  34. // td的内边距
  35. padding: {
  36. type: String,
  37. default: '10rpx 6rpx'
  38. },
  39. // 字体大小
  40. fontSize: {
  41. type: [String, Number],
  42. default: 28
  43. },
  44. // 字体颜色
  45. color: {
  46. type: String,
  47. default: '#606266'
  48. },
  49. // th的自定义样式
  50. thStyle: {
  51. type: Object,
  52. default () {
  53. return {}
  54. }
  55. },
  56. // table的背景颜色
  57. bgColor: {
  58. type: String,
  59. default: '#ffffff'
  60. }
  61. },
  62. data() {
  63. return {}
  64. },
  65. computed: {
  66. tableStyle() {
  67. let style = {};
  68. style.borderLeft = `solid 1px ${this.borderColor}`;
  69. style.borderTop = `solid 1px ${this.borderColor}`;
  70. style.backgroundColor = this.bgColor;;
  71. return style;
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. @import "../../libs/css/style.components.scss";
  78. .u-table {
  79. width: 100%;
  80. box-sizing: border-box;
  81. }
  82. </style>