|
|
@@ -14,8 +14,8 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="my-move">
|
|
|
- <div class="pre" @click.stop="switchPic('pre',item)" v-if="index!==0">上一张</div>
|
|
|
- <div class="next" @click.stop="switchPic('next',item)" v-if="index!==dataList.length-1">下一张</div>
|
|
|
+ <div class="pre" @click.stop="switchPic('pre',item,index)" v-if="index!==0">上一张</div>
|
|
|
+ <div class="next" @click.stop="switchPic('next',item,index)" v-if="index!==dataList.length-1">下一张</div>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li v-if="dataList.length < 5" @click="edit({}, 'add')">
|
|
|
@@ -136,7 +136,7 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- switchPic(type,item){
|
|
|
+ switchPic(type,item,index){
|
|
|
this.bigBoxShow=true
|
|
|
let len = this.dataList.length;
|
|
|
if(len === 1) {
|
|
|
@@ -148,14 +148,14 @@ export default {
|
|
|
let nextCurrentItem = {};
|
|
|
if(currentItem.sort === 1) {
|
|
|
preCurrentItem = this.dataList[this.dataList.length-1];
|
|
|
- nextCurrentItem = this.dataList.filter(e=>e.sort === currentItem.sort+1)[0];
|
|
|
+ nextCurrentItem = this.dataList.filter(e=>e.sort === this.dataList[index+1].sort)[0];
|
|
|
}
|
|
|
- else if(currentItem.sort === this.dataList.length) {
|
|
|
- preCurrentItem = this.dataList.filter(e=>e.sort === currentItem.sort-1)[0];
|
|
|
+ else if(index===4) {
|
|
|
+ preCurrentItem = this.dataList.filter(e=>e.sort === this.dataList[index-1].sort)[0];
|
|
|
nextCurrentItem = this.dataList[0];
|
|
|
} else {
|
|
|
- preCurrentItem = this.dataList.filter(e=>e.sort === currentItem.sort-1)[0] ;
|
|
|
- nextCurrentItem = this.dataList.filter(e=>e.sort === currentItem.sort+1)[0];
|
|
|
+ preCurrentItem = this.dataList.filter(e=>e.sort === this.dataList[index-1].sort)[0] ;
|
|
|
+ nextCurrentItem = this.dataList.filter(e=>e.sort === this.dataList[index+1].sort)[0];
|
|
|
}
|
|
|
if(type === 'pre') {
|
|
|
[preCurrentItem.sort,currentItem.sort] = [currentItem.sort,preCurrentItem.sort]
|