Browse Source

轮播图增加跳转

htc 14 hours ago
parent
commit
724d2dc56c
1 changed files with 16 additions and 0 deletions
  1. 16 0
      pages/home.vue

+ 16 - 0
pages/home.vue

@@ -13,6 +13,7 @@
 				<up-swiper
 					:list="bannarList"
 					@change="e => current = e.current"
+					@click="bannerClick"
 					:autoplay="true"
 					:interval="2000"
 					:duration="200"
@@ -73,6 +74,21 @@
 	const scrollLeft = ref(0)
 	const activityList = ref([])
 	
+	const bannerClick = e => {
+		let banner = bannarOrigin.value[e];
+		if(banner&&banner?.redirect){
+			if(banner?.redirectType==1){//微信公众号
+				uni.navigateTo({
+					url:'/pages/webView?src='+banner?.redirect
+				})
+			}else if(banner?.redirectType==2){//微信小程序
+				uni.navigateToMiniProgram({
+					appId:banner?.redirect
+				})
+			}
+		}
+	}
+	
 	const changeType = (item,index) => {
 		tlIndex.value = index;
 		if(typeList.value.length>4){