zhaoxiaohai 2 years ago
parent
commit
0e3dd0437e
2 changed files with 7 additions and 8 deletions
  1. 6 7
      pages/tabbar/home/index.js
  2. 1 1
      pages/tabbar/home/index.wxml

+ 6 - 7
pages/tabbar/home/index.js

@@ -213,13 +213,12 @@ Page({
     },
     /* banner */
     bannerClick(e) {
-        const {
-            hyperlink
-        } = e.currentTarget.dataset;
-        if (!hyperlink) return;
-        wx.navigateTo({
-            url: hyperlink
-        })
+        const hyperlink = e.currentTarget.dataset.hyperlink.split(":");
+        if (hyperlink[0] == 'path') {
+            wx.navigateTo({
+                url: hyperlink[1]
+            })
+        }
     },
     /**
      * 生命周期函数--监听页面显示

+ 1 - 1
pages/tabbar/home/index.wxml

@@ -15,7 +15,7 @@
     <view class="banner_oval" />
     <swiper class='banner_content'>
         <swiper-item wx:for="{{bannerList}}">
-            <image src="{{item.attinfos[0].url}}" mode="aspectFill" data-hyperlink="{{hyperlink}}" bindtap="bannerClick" />
+            <image src="{{item.attinfos[0].url}}" mode="aspectFill" data-hyperlink="{{item.hyperlink}}" catchtap="bannerClick" />
         </swiper-item>
     </swiper>
 </view>