index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view>
  3. <u-table v-if="tableList.length > 0">
  4. <u-tr class="u-tr">
  5. <u-th v-for="(item) in options" class="u-th">{{ item.label }}</u-th>
  6. </u-tr>
  7. <u-tr v-for="(row,index) in tableList" class="u-tr">
  8. <u-td v-for="(col,coli) in options" class="u-td">
  9. <view v-if="col.prop == 'menu'" class="menu" @click="view(row)">
  10. 查看
  11. </view>
  12. <view v-else>{{ row[col['prop']] }}</view>
  13. </u-td>
  14. </u-tr>
  15. </u-table>
  16. <view v-else class="empty">
  17. <view>
  18. <view class="tip">
  19. <view>暂无数据</view>
  20. </view>
  21. <!-- <view @click="add" class="l_b">新增物建员</view> -->
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. name: 'table-dom',
  29. props: {
  30. tableList: {
  31. type: Array,
  32. default: []
  33. },
  34. options: {
  35. type: Array,
  36. default: []
  37. },
  38. },
  39. methods: {
  40. view(row) {
  41. this.$emit('view', row)
  42. }
  43. // add() {
  44. // uni.navigateTo({
  45. // url: `/pages/home/detail?type=add&ldId=${this.ldId}&dyh=${this.dyh}`
  46. // })
  47. // }
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .menu {
  53. color: rgba(16, 109, 255, 1);
  54. }
  55. .empty {
  56. display: flex;
  57. align-items: center;
  58. justify-content: center;
  59. .tip {
  60. height: 88rpx;
  61. width: 50vw;
  62. display: flex;
  63. align-items: center;
  64. justify-content: center;
  65. }
  66. .l_b {
  67. background-color: rgba(16, 109, 255, 1);
  68. border-radius: 16rpx;
  69. width: 50vw;
  70. height: 88rpx;
  71. display: flex;
  72. align-items: center;
  73. justify-content: center;
  74. color: rgba(255, 255, 255, 1);
  75. font-size: 36rpx;
  76. font-weight: 600;
  77. }
  78. }
  79. </style>