hanbaoshan
2020-12-20 ecb6cadc3f016cf9968f48e0cc77479a1e56365b
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);
    }
  }
};