Kaynağa Gözat

修改预览图片 显示序号错误

wly 2 hafta önce
ebeveyn
işleme
498e10cd05

+ 2 - 1
components/kxj-previewImage/kxj-previewImage.vue

@@ -215,8 +215,8 @@
 					console.log('kxj-previewImage:打开参数无效');
 					return;
 				}
-
 				if (!isNaN(e)) {
+
 					if (e >= this.imgs.length) {
 						console.log('kxj-previewImage:打开参数无效');
 					} else {
@@ -224,6 +224,7 @@
 					}
 				} else {
 					var index = this.imgs.indexOf(e);
+
 					if (index === -1) {
 						this.imgs = [e];
 						this.index = 0;

+ 3 - 8
pages/article/article.vue

@@ -120,14 +120,9 @@
 			//打开预览e
 			previewOpen(imgs1, index) {
 				this.imgs = imgs1.split("|");
-				// this.descs = [];
-				// for (var i = 0; i < this.imgs.length; i++) {
-				// 	this.descs.push(i + 1);
-				// }
-				// var param = e.currentTarget.dataset.src;
-				// console.log(param);
-				// this.imgs = ['../../static/home/avator.png', '../../static/me/sex_2.png', '../../static/home/avator.png'];
-				this.$refs.previewImage.open(index || 1); // 传入当前选中的图片地址或序号
+				this.$nextTick(()=>{
+					this.$refs.previewImage.open(index)
+				})
 				return; //如需测试和uni原生预览差别可注释这两行
 			},
 			loadData() {

+ 3 - 1
pages/index/peopleHome.vue

@@ -224,7 +224,9 @@
 			},
 			previewOpen(imgs1, index) {
 				this.imgs = imgs1.split("|");
-				this.$refs.previewImage.open(index || 1); // 传入当前选中的图片地址或序号
+				this.$nextTick(()=>{
+					this.$refs.previewImage.open(index)
+				}) // 传入当前选中的图片地址或序号
 				return; //如需测试和uni原生预览差别可注释这两行
 			},
 			loadWishData() {

+ 3 - 1
pages/my/myArticle.vue

@@ -172,7 +172,9 @@
 				// var param = e.currentTarget.dataset.src;
 				// console.log(param);
 				// this.imgs = ['../../static/home/avator.png', '../../static/me/sex_2.png', '../../static/home/avator.png'];
-				this.$refs.previewImage.open(1); // 传入当前选中的图片地址或序号
+				this.$nextTick(()=>{
+					this.$refs.previewImage.open(index)
+				})// 传入当前选中的图片地址或序号
 				return; //如需测试和uni原生预览差别可注释这两行
 			},
 			//长按事件