tui-tr.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view
  3. class="tui-table__row"
  4. :class="{ 'tui-flex-wrap': flexWrap, 'tui-table__fixed': fixed }"
  5. :style="{
  6. backgroundColor: backgroundColor,
  7. borderBottom: `${borderWidth} solid ${borderColor}`,
  8. borderLeft: borderLeft ? `${borderWidth} solid ${borderColor}` : '0',
  9. borderTop: borderTop ? `${borderWidth} solid ${borderColor}` : '0',
  10. left: fixed ? left : 'auto',
  11. right: fixed ? right : 'auto',
  12. top: fixed ? top : 'auto',
  13. marginTop: marginTop
  14. }"
  15. @tap="handleClick"
  16. >
  17. <slot></slot>
  18. </view>
  19. </template>
  20. <script>
  21. //table tr
  22. export default {
  23. name: 'tuiTr',
  24. emits: ['click'],
  25. options: {
  26. // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现
  27. virtualHost: true
  28. },
  29. props: {
  30. backgroundColor: {
  31. type: String,
  32. default: '#fff'
  33. },
  34. //border-bottom width
  35. borderWidth: {
  36. type: String,
  37. default: '1rpx'
  38. },
  39. //border-bottom color
  40. borderColor: {
  41. type: String,
  42. default: '#EAEEF5'
  43. },
  44. borderLeft: {
  45. type: Boolean,
  46. default: false
  47. },
  48. borderTop: {
  49. type: Boolean,
  50. default: false
  51. },
  52. flexWrap: {
  53. type: Boolean,
  54. default: false
  55. },
  56. fixed: {
  57. type: Boolean,
  58. default: false
  59. },
  60. left: {
  61. type: String,
  62. default: '0'
  63. },
  64. right: {
  65. type: String,
  66. default: '0'
  67. },
  68. top: {
  69. type: String,
  70. // #ifdef H5
  71. default: '44px',
  72. // #endif
  73. // #ifndef H5
  74. default: '0'
  75. // #endif
  76. },
  77. marginTop: {
  78. type: String,
  79. default: '0'
  80. },
  81. //行数索引
  82. index: {
  83. type: Number,
  84. default: 0
  85. },
  86. //参数
  87. params: {
  88. type: String,
  89. default: ''
  90. }
  91. },
  92. data() {
  93. return {};
  94. },
  95. methods: {
  96. handleClick() {
  97. this.$emit('click', {
  98. index: this.index,
  99. params: this.params
  100. });
  101. }
  102. }
  103. };
  104. </script>
  105. <style scoped>
  106. .tui-table__row {
  107. width: 100%;
  108. display: flex;
  109. box-sizing: border-box;
  110. }
  111. .tui-flex-wrap {
  112. flex-wrap: wrap;
  113. }
  114. .tui-table__fixed {
  115. position: fixed;
  116. z-index: 99;
  117. }
  118. </style>