Browse Source

代码提交;

Handy_Cao 3 năm trước cách đây
mục cha
commit
45b573804d

+ 8 - 8
GuangZuan/miniprogram/app.json

@@ -35,26 +35,26 @@
       {
         "pagePath": "pages/home/home/home",
         "text": "首页",
-        "iconPath": "/images/tabbar/tab_home.png",
-        "selectedIconPath": "/images/tabbar/tab_home_actived.png"
+        "selectedIconPath": "/images/tabbar/tab_home_actived.png",
+        "iconPath": "/images/tabbar/tab_home.png"
       },
       {
         "pagePath": "pages/trade/trade/trade",
         "text": "交易",
-        "iconPath": "/images/tabbar/tab_xiaoshou.png",
-        "selectedIconPath": "/images/tabbar/tab_xiaoshou_actived.png"
+        "selectedIconPath": "/images/tabbar/tab_changkou_actived.png",
+        "iconPath": "/images/tabbar/tab_changkou.png"
       },
       {
         "pagePath": "pages/circle/circle/circle",
         "text": "钻石圈",
-        "iconPath": "/images/tabbar/tab_caigou.png",
-        "selectedIconPath": "/images/tabbar/tab_caigou_actived.png"
+        "selectedIconPath": "/images/tabbar/tab_caigou_actived.png",
+        "iconPath": "/images/tabbar/tab_caigou.png"
       },
       {
         "pagePath": "pages/mine/mine/mine",
         "text": "我的",
-        "iconPath": "/images/tabbar/tab_changkou.png",
-        "selectedIconPath": "/images/tabbar/tab_changkou_actived.png"
+        "selectedIconPath": "/images/tabbar/tab_xiaoshou_actived.png",
+        "iconPath": "/images/tabbar/tab_xiaoshou.png"
       }
     ]
   },

+ 2 - 2
GuangZuan/miniprogram/app.wxss

@@ -3,8 +3,8 @@
   height: 100%;
   display: flex;
   flex-direction: column;
-  align-items: center;
+  align-items: c;
   justify-content: space-between;
   padding: 200rpx 0;
   box-sizing: border-box;
-} 
+} 

+ 7 - 0
GuangZuan/miniprogram/componets/custom-tab-bar/index.json

@@ -0,0 +1,7 @@
+{
+  "component": true,
+  "usingComponents": {
+    "van-tabbar": "@vant/weapp/tabbar/index",
+    "van-tabbar-item": "@vant/weapp/tabbar-item/index"
+  }
+}

+ 56 - 0
GuangZuan/miniprogram/componets/custom-tab-bar/index.ts

@@ -0,0 +1,56 @@
+// componets/custom-tab-bar/index.ts
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    active: 0,
+    list: [{
+      icon: 'home-o',
+      text: '首页',
+      url: '/pages/home/home/home'
+    },
+    {
+      icon: 'search',
+      text: '钻石圈',
+      url: '/pages/circle/circle/circle'
+    },
+    {
+      icon: 'search',
+      text: '交易',
+      url: '/pages/trade/trade/trade'
+    },
+    {
+      icon: 'search',
+      text: '我的',
+      url: '/pages/mine/mine/mine'
+    }]
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    onChange(e) {
+      this.setData({ active: e.detail });
+      console.log(this.data.list[e.detail].url)
+			wx.switchTab({
+				url: this.data.list[e.detail].url
+			});
+    },
+    
+    init() {
+			const page = getCurrentPages().pop();
+			this.setData({
+				active: this.data.list.findIndex(item => item.url === `/${page.route}`)
+			});
+		}
+  }
+})

+ 6 - 0
GuangZuan/miniprogram/componets/custom-tab-bar/index.wxml

@@ -0,0 +1,6 @@
+<!--componets/custom-tab-bar/index.wxml-->
+<van-tabbar active="{{ active }}" bind:change="onChange">
+  <van-tabbar-item wx:for="{{ list }}" wx:key="index" icon="{{ item.icon }}">{{
+    item.text
+  }}</van-tabbar-item>
+</van-tabbar>

+ 1 - 0
GuangZuan/miniprogram/componets/custom-tab-bar/index.wxss

@@ -0,0 +1 @@
+/* componets/custom-tab-bar/index.wxss */

+ 2 - 1
GuangZuan/miniprogram/pages/home/home/home.json

@@ -1,6 +1,7 @@
 {
   "usingComponents": {
-    "goodscard": "/componets/goodscard/goodscard"
+    "goodscard": "/componets/goodscard/goodscard",
+    "tabbar": "/componets/custom-tab-bar/index"
   },
   "navigationBarTitleText": "广钻平台"
 }

+ 3 - 0
GuangZuan/miniprogram/pages/home/home/home.ts

@@ -1,4 +1,7 @@
 // pages/home/home/home.ts
+
+const app = getApp()
+
 Page({
 
   /**

+ 0 - 1
GuangZuan/miniprogram/pages/home/home/home.wxml

@@ -1,6 +1,5 @@
 <!--pages/home/home/home.wxml-->
 
-<!-- 首页 -->
 
 
 <!-- banner轮播图 -->