panyong пре 2 година
родитељ
комит
8e42b2a800

+ 5 - 4
htmldev/wxMini/pages/business/business.wxml

@@ -1,5 +1,5 @@
-<view class="app_page-header-search">
-  <view class="app_page-header-search-warp app_width-690 page-header-search">
+<view class="app_page-header-search page-header-search">
+  <view class="app_page-header-search-warp app_width-690">
     <label for="header-search">
       <image src=""></image>
     </label>
@@ -9,14 +9,15 @@
 <scroll-view
   class="app_nav-wrap"
   scroll-x="{{true}}"
-  scroll-with-animation="{{true}}">
+  scroll-with-animation="{{true}}"
+  scroll-into-view="item-{{currentCategory * 1 < 4 ? 0 : currentCategory * 1 - 3}}">
   <view
     class="nav {{currentCategory === item.id ? 'active' : ''}}"
     wx:for="{{category}}"
     wx:key="id"
     data-item="{{item}}"
     bind:tap="handleNav">
-    <view class="photo">
+    <view class="photo" id="item-{{index}}">
       <image src=""></image>
     </view>
     <view class="name">{{item.name}}</view>

+ 9 - 0
htmldev/wxMini/pages/guide/guide.js

@@ -100,5 +100,14 @@ Page({
     wx.navigateTo({
       url: '/pages/shoppingCar/shoppingCar'
     })
+  },
+  handleNav(e) {
+    const {
+      item
+    } = e.currentTarget.dataset
+
+    this.setData({
+      currentCategory: item.id
+    })
   }
 })

+ 13 - 3
htmldev/wxMini/pages/guide/guide.wxml

@@ -10,12 +10,22 @@
       <image src=""></image>
     </view>
   </view>
-  <scroll-view class="app_nav-wrap" scroll-x="{{true}}">
-    <view class="nav {{currentCategory === item.id ? 'active' : ''}}" wx:for="{{category}}" wx:key="id">
-      <view class="photo">
+  <scroll-view
+    class="app_nav-wrap"
+    scroll-x="{{true}}"
+    scroll-with-animation="{{true}}"
+    scroll-into-view="item-{{currentCategory * 1 < 4 ? 0 : currentCategory * 1 - 3}}">
+    <view
+      class="nav {{currentCategory === item.id ? 'active' : ''}}"
+      wx:for="{{category}}"
+      wx:key="id"
+      data-item="{{item}}"
+      bind:tap="handleNav">
+      <view class="photo" id="item-{{index}}">
         <image src=""></image>
       </view>
       <view class="name">{{item.name}}</view>
     </view>
   </scroll-view>
+
 </view>