You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
1.4 KiB

  1. <template>
  2. <view class="u-th" :style="[thStyle]">
  3. <slot></slot>
  4. </view>
  5. </template>
  6. <script>
  7. /**
  8. * th th单元格
  9. * @description 表格组件一般用于展示大量结构化数据的场景(搭配u-table使用)
  10. * @tutorial https://www.uviewui.com/components/table.html#td-props
  11. * @property {String Number} width 标题单元格宽度百分比或者具体带单位的值,如30%,200rpx等,一般使用百分比,单元格宽度默认为均分tr的长度
  12. * @example 暂无示例
  13. */
  14. export default {
  15. name: "u-th",
  16. props: {
  17. // 宽度,百分比或者具体带单位的值,如30%, 200rpx等,一般使用百分比
  18. width: {
  19. type: [Number, String],
  20. default: ''
  21. }
  22. },
  23. inject: ['uTable'],
  24. computed: {
  25. thStyle() {
  26. let style = {};
  27. if (this.width) style.flex = `0 0 ${this.width}`;
  28. style.textAlign = this.uTable.align;
  29. style.padding = this.uTable.padding;
  30. style.borderBottom = `solid 1px ${this.uTable.borderColor}`;
  31. style.borderRight = `solid 1px ${this.uTable.borderColor}`;
  32. Object.assign(style, this.uTable.thStyle);
  33. return style;
  34. }
  35. }
  36. };
  37. </script>
  38. <style lang="scss" scoped>
  39. @import "../../libs/css/style.components.scss";
  40. .u-th {
  41. display: flex;
  42. flex-direction: column;
  43. flex: 1;
  44. justify-content: center;
  45. font-size: 28rpx;
  46. color: $u-main-color;
  47. font-weight: bold;
  48. background-color: rgb(245, 246, 248);
  49. }
  50. </style>