取二维数组中下一项

87 阅读1分钟
            let title = '';
            const indexMax = this.arr.length - 1;
            const sIndexMax = this.arr[indexs[0]].skuDetails.length - 1;
            if (indexs[0] >= indexMax && indexs[1] >= sIndexMax) {
                    title = '没有下一个了';
            }
            if (title) {
                    uni.showToast({
                            title,
                            position: 'top'
                    });
                    return;
            }
            const isEnd = indexs[1] >= sIndexMax;
            const item = isEnd ? this.arr[indexs[0] + 1] : this.arr[indexs[0]];
            this.check({
                    item,
                    index: isEnd ? indexs[0] + 1 : indexs[0],
                    item1: isEnd ? item.skuDetails[0] : item.skuDetails[indexs[1] + 1],
				index1: isEnd ? 0 : indexs[1] + 1
			});