index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view>
  3. <view class="sheng" v-for="(sheng) in treeList" :key="sheng.ldph">
  4. <view v-if="sheng.isClick">
  5. <view class="h_d s_u s_c" @click="shengClick(sheng)">
  6. <view>{{ sheng.ldph }}</view>
  7. <image :src="icon_arrow_up_black_16" class="s_i"></image>
  8. </view>
  9. <view class="shi" v-for="(shi) in sheng.data" :key="shi.ldph">
  10. <view class="shi_c" v-if="shi.isClick">
  11. <view class="shi_u h_d" @click="shiClick(shi)">
  12. <view>{{ shi.ldph }}</view>
  13. <image :src="icon_arrow_up_round_16" class="shi_i"></image>
  14. </view>
  15. <view class="qu_b">
  16. <view v-for="(qu,index) in shi.data" :key="qu.ldph" class="qu_item"
  17. @click="quClick(qu,shi,index)">
  18. {{ qu.ldph }}
  19. </view>
  20. </view>
  21. </view>
  22. <view class="shi_u h_d" v-else @click="shiClick(shi)">
  23. <view>{{ shi.ldph }}</view>
  24. <image :src="icon_arrow_down_round_16" class="shi_i"></image>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="s_u h_d" v-else @click="shengClick(sheng)">
  29. <view>{{ sheng.ldph }}</view>
  30. <image :src="icon_arrow_down_black_16" class="s_i"></image>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. name: 'tree-address',
  38. props: {
  39. treeList: {
  40. type: Array,
  41. default: []
  42. }
  43. },
  44. data() {
  45. return {
  46. icon_arrow_down_black_16: require('./img/icon_arrow_down_black_16.svg'),
  47. icon_arrow_up_black_16: require('./img/icon_arrow_up_black_16.svg'),
  48. icon_arrow_down_round_16: require('./img/icon_arrow_down_round_16.svg'),
  49. icon_arrow_up_round_16: require('./img/icon_arrow_up_round_16.svg'),
  50. }
  51. },
  52. methods: {
  53. shengClick(item) {
  54. item.isClick = !item.isClick
  55. },
  56. shiClick(item) {
  57. item.isClick = !item.isClick
  58. },
  59. quClick(item, parent, index) {
  60. this.$emit('node-click', item, parent.data, index)
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .sheng {
  67. margin: 0 24rpx 24rpx 24rpx;
  68. background-color: rgba(255, 255, 255, 1);
  69. border-radius: 16rpx;
  70. padding: 0 24rpx;
  71. color: rgba(17, 17, 17, 1);
  72. font-size: 32rpx;
  73. font-weight: 600;
  74. .shi {
  75. color: rgba(17, 17, 17, 1);
  76. font-size: 28rpx;
  77. padding-left: 24rpx;
  78. .qu_b {
  79. background-color: rgba(248, 248, 248, 1);
  80. border-radius: 16rpx;
  81. padding: 8rpx;
  82. }
  83. .qu_item {
  84. width: 100%;
  85. height: 88rpx;
  86. padding: 24rpx;
  87. }
  88. .shi_c:last-child {
  89. padding-bottom: 24rpx;
  90. }
  91. .shi_u {
  92. width: 100%;
  93. height: 88rpx;
  94. }
  95. .shi_i {
  96. width: 32rpx;
  97. height: 32rpx;
  98. }
  99. }
  100. .s_c {
  101. border-bottom: 1rpx solid rgba(231, 231, 231, 1);
  102. }
  103. .h_d {
  104. display: flex;
  105. align-items: center;
  106. justify-content: space-between;
  107. }
  108. .s_u {
  109. width: 100%;
  110. height: 108rpx;
  111. }
  112. .s_i {
  113. width: 32rpx;
  114. height: 32rpx;
  115. }
  116. }
  117. </style>