selectGoods.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="container">
  3. <view class="gap"></view>
  4. <view class="body">
  5. <!-- 左边区域 -->
  6. <view class="left">
  7. <view class="left_item" :class="{ active: active_left === index }" v-for="(item, index) in leftList" :key="index" @click="handleChange(index)">
  8. {{ item }}
  9. </view>
  10. </view>
  11. <!-- 右边区域 -->
  12. <view class="right">
  13. <view class="right_item" :class="{ active: active_right === index }" v-for="(item, index) in rightList" :key="index" @click="handleChange2(index)">
  14. {{ item }}
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. // 左边分类数组当前索引
  25. active_left: 0,
  26. // 左边分类数组
  27. leftList: ['其他', '水电'],
  28. // 右边分类数组当前索引
  29. active_right: 0,
  30. // 右边分类数组
  31. rightList: ['下水道', '安全指示牌', '消费应急灯', '排水管道', '吊顶', '风扇', '没电']
  32. }
  33. },
  34. methods: {
  35. handleChange(index) {
  36. this.active_left = index
  37. },
  38. handleChange2(index) {
  39. this.active_right = index
  40. const repairsGoods = this.leftList[this.active_left] + this.rightList[this.active_right]
  41. uni.$emit('addRepairsGoods', {
  42. data: repairsGoods
  43. })
  44. uni.navigateBack(1)
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .container {
  51. width: 100vw;
  52. height: 100vh;
  53. .gap {
  54. height: 10rpx;
  55. background-color: #f2f2f2;
  56. }
  57. .body {
  58. display: flex;
  59. height: calc(100vh - 10rpx);
  60. .left {
  61. box-sizing: border-box;
  62. padding: 15rpx;
  63. width: 198rpx;
  64. border-right: 1rpx solid #ccc;
  65. overflow-y: auto;
  66. .left_item {
  67. width: 100%;
  68. height: 80rpx;
  69. line-height: 80rpx;
  70. text-align: center;
  71. font-size: 28rpx;
  72. overflow: hidden;
  73. white-space: nowrap;
  74. text-overflow: ellipsis;
  75. }
  76. .active {
  77. color: #6fb6b8;
  78. }
  79. }
  80. .right {
  81. box-sizing: border-box;
  82. padding: 30rpx 40rpx;
  83. width: 552rpx;
  84. overflow-y: auto;
  85. .right_item {
  86. float: left;
  87. box-sizing: border-box;
  88. padding: 10rpx 30rpx;
  89. margin: 0 32rpx 37rpx 0;
  90. height: 50rpx;
  91. line-height: 30rpx;
  92. text-align: center;
  93. color: #808080;
  94. font-size: 28rpx;
  95. border-radius: 53rpx;
  96. background-color: #e6e6e6;
  97. overflow: hidden;
  98. white-space: nowrap;
  99. text-overflow: ellipsis;
  100. }
  101. .active {
  102. color: #fff;
  103. background-color: #6fb6b8;
  104. }
  105. }
  106. }
  107. }
  108. </style>