editContent.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="apply-list">
  3. <view class="apply-list-item"   v-for="(item,index) in editList" :key="index">
  4. <view class="apply-list-item-title">
  5. {{item.title}}
  6. </view>
  7. <view class="apply-info">
  8. <view class="apply-info-item" v-for="(item1,index1) in item.childer" :key="index1">
  9. <view class="apply-info-item-img">
  10. <image style="width: 100%;height: 100%;" :src="item1.img" mode=""></image>
  11. <view v-if="show" class="home-edit-item-img-icon" @click="add(item1)">
  12. +
  13. </view>
  14. </view>
  15. <view class="apply-info-item-text">
  16. {{item1.title}}
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name: "editContent",
  26. props: {
  27. list: {
  28. type: Array,
  29. default: () => []
  30. }
  31. },
  32. data() {
  33. return {
  34. };
  35. },
  36. methods: {
  37. add(item) {
  38. item.show = !item.show
  39. this.$emit('update:list', this.list)
  40. }
  41. },
  42. computed: {
  43. show() {
  44. let arr = []
  45. this.list.forEach(item => {
  46. item.childer.forEach(item1 => {
  47. if (item1.show) {
  48. arr.push(item1)
  49. }
  50. })
  51. })
  52. let flag = false
  53. if(arr.length >=3){
  54. flag = false
  55. }else {
  56. flag = true
  57. }
  58. return flag
  59. },
  60. editList() {
  61. let arr = []
  62. this.list.forEach(item => {
  63. let obj = {
  64. title: item.title,
  65. childer: []
  66. }
  67. item.childer.forEach(item1 => {
  68. if (!item1.show) {
  69. obj.childer.push(item1)
  70. }
  71. })
  72. arr.push(obj)
  73. })
  74. return arr
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .apply-list {
  81. width: 100%;
  82. .apply-list-item {
  83. padding: 32rpx 32rpx 0 32rpx;
  84. background-color: #fff;
  85. border-radius: 5.33px;
  86. box-shadow: 0px 0px 6.67px 0px rgba(147, 147, 147, 0.20);
  87. margin-bottom: 32rpx;
  88. .apply-list-item-title {
  89. font-size: 32rpx;
  90. margin-bottom: 32rpx;
  91. }
  92. }
  93. .apply-info {
  94. width: 100%;
  95. display: flex;
  96. flex-wrap: wrap;
  97. .apply-info-item {
  98. width: 20%;
  99. display: flex;
  100. flex-direction: column;
  101. align-items: center;
  102. justify-content: center;
  103. margin-bottom: 32rpx;
  104. .apply-info-item-img {
  105. width: 50rpx;
  106. height: 50rpx;
  107. position: relative;
  108. }
  109. .apply-info-item-text {
  110. font-size: 24rpx;
  111. }
  112. }
  113. }
  114. }
  115. .home-edit-item-img-icon {
  116. width: 30rpx;
  117. height: 32rpx;
  118. background-color: rgba(153, 153, 153, 1);
  119. font-size: 24rpx;
  120. color: #fff;
  121. text-align: center;
  122. line-height: 30rpx;
  123. border-radius: 50%;
  124. position: absolute;
  125. right: -15rpx;
  126. top: -15rpx;
  127. }
  128. </style>