ZZJ
2021-11-09 ccee429d379e0108b7445f72ade8d97c110a6fb3
src/pages/cameraAccess/components/scene/SlideScene.vue
@@ -30,7 +30,7 @@
                  </svg>-->
                  <img
                    class="baseImg"
                    :src="item.rules[0].icon_blob &&item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    :src="item.rules[index].icon_blob &&item.rules[index].icon_blob.indexOf(',')>0?item.rules[index].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    alt
                  />
                </div>
@@ -42,7 +42,7 @@
                  </svg>-->
                  <img
                    class="baseImg"
                    :src="item.rules[0].icon_blob &&item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    :src="item.rules[index].icon_blob &&item.rules[index].icon_blob.indexOf(',')>0?item.rules[index].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    alt
                  />
                </div>
@@ -54,7 +54,7 @@
                  </svg>-->
                  <img
                    class="baseImg"
                    :src="item.rules[0].icon_blob && item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    :src="item.rules[index].icon_blob && item.rules[index].icon_blob.indexOf(',')>0?item.rules[index].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    alt
                  />
                </div>
@@ -79,6 +79,7 @@
</template>
<script>
import {chunkArr} from '@/scripts/util';
export default {
  props: [
    // 'swiperOption',
@@ -130,27 +131,10 @@
    // this.mySwiper = this.$refs.sceneSwiper.swiper;
  },
  methods: {
    //拆分二维数组
    chunk(arr, size = 1) {
      if (arr.length == 0) return;
      const tempContainer = [];
      let innerArr = [];
      arr.forEach(item => {
        if (innerArr.length == 0) {
          tempContainer.push(innerArr);
        }
        innerArr.push(item);
        if (innerArr.length == size) {
          innerArr = [];
        }
      });
      return tempContainer;
    }
  },
  computed: {
    slides() {
      return this.chunk(this.mockSceneData, 5);
      return chunkArr(this.mockSceneData, 5);
    }
  }
};