| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import {chunkArr} from '@/scripts/util';
|
| | | export default {
|
| | | props: [
|
| | | // 'swiperOption',
|
| | |
| | | // 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);
|
| | | }
|
| | | }
|
| | | };
|