hanbaoshan
2020-12-21 d7c6e0d1ec18f391243f77eb62bcb111378cb40f
src/pages/cameraAccess/components/scene/SlideScene.vue
@@ -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);
    }
  }
};