Selaa lähdekoodia

feature: 添加分包

Damon 1 vuosi sitten
vanhempi
commit
6b2a74abd1

+ 25 - 23
app.json

@@ -14,34 +14,36 @@
     "pages/download/download",
     "pages/wakeList/wakeList",
     "pages/aboutInfo/aboutInfo",
-    "pages/home/home",
-    "pages/detail/detail"
+    "pages/home/home"
   ],
+
+  "subPackages": [{
+    "root": "pages/piano/",
+    "pages": [
+      "detail/detail"
+    ]
+  }],
+
   "tabBar": {
-    "custom": true,
-    "color": "#000",
-    "selectedColor": "#4d94f0",
-    "backgroundColor": "#fff",
     "borderStyle": "black",
-    "list": [
+    "list": [{
+      "pagePath": "pages/index/index",
+      "text": "首页",
+      "iconPath": "./img/index_unaction.png",
+      "selectedIconPath": "./img/index_action.png"
+    },
       {
         "pagePath": "pages/home/home",
-        "text": "首页",
-        "iconPath": "/img/index_unaction.png",
-        "selectedIconPath": "/img/index_action.png"
-        },
-        {
-          "pagePath": "pages/index/index",
-          "text": "频道",
-          "iconPath": "/img/index_unaction.png",
-          "selectedIconPath": "/img/index_action.png"
-          },
-        {
-          "pagePath": "pages/me/me",
-          "text": "我的",
-          "iconPath": "/img/me_unaction.png",
-          "selectedIconPath": "/img/me_action.png"
-        }
+        "text": "首页2",
+        "iconPath": "./img/index_unaction.png",
+        "selectedIconPath": "./img/index_action.png"
+      },
+      {
+        "pagePath": "pages/me/me",
+        "text": "我的",
+        "iconPath": "./img/me_unaction.png",
+        "selectedIconPath": "./img/me_action.png"
+      }
     ]
   },
   "window": {

+ 0 - 0
img/piano


+ 0 - 5
pages/detail/detail.json

@@ -1,5 +0,0 @@
-{
-  "usingComponents": {
-    "nav-bar": "./../components/navbar/navbar"
-  }
-}

+ 26 - 0
pages/detail/detail.js

@@ -5,6 +5,16 @@ Page({
    * 页面的初始数据
    */
   data: {
+    topList: [{
+      name: "木鱼",
+      image: "./../../../img/min.png",
+    }, {
+      name: "壁纸",
+      image: "./../../../img/min.png",
+    }, {
+      name: "曲谱",
+      image: "./../../../img/min.png",
+    }, ],
     nvabarData: {
       showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
       title: '设备详情', //导航栏 中间的标题
@@ -32,6 +42,22 @@ Page({
 
   },
 
+  clickTopItem(e) {
+    var that = this;
+    switch (e.currentTarget.dataset.index) {
+      ///木鱼
+      case 0:
+        break;
+        ///壁纸
+      case 1:
+        break;
+        ///曲谱
+      case 2:
+        break;
+    }
+    console.log("获取当前数据=====" + JSON.stringify(index) + "====" + JSON.stringify(e));
+  },
+
   /**
    * 生命周期函数--监听页面隐藏
    */

+ 5 - 0
pages/piano/detail/detail.json

@@ -0,0 +1,5 @@
+{
+  "usingComponents": {
+    "nav-bar": "../../components/navbar/navbar"
+  }
+}

+ 10 - 3
pages/detail/detail.wxml

@@ -2,8 +2,15 @@
   <nav-bar bind:goBack="_goBack" nav-bgc-class="ex-nav-bgc-class" nav-title-class="ex-nav-title-class" ex-back-pre="ex-back-pre" navbar-data='{{nvabarData}}'>
   </nav-bar>
 
-  <view class="top_item_public">
-    <view class="top_item">
+  <view class="top_item_public_add">
+    <view class="top_item_public" wx:for="{{topList}}" wx:key="key" wx:for-item="item" wx:for-index="index">
+      <view class="top_item" bind:tap="clickTopItem" data-index="{{index}}">
+        <image class="top_image" mode="heightFix" src="{{item.image}}"></image>
+        <view class="top_text">{{item.name}}</view>
+      </view>
+    </view>
+
+    <!-- <view class="top_item">
       <image class="device_pic" mode="heightFix" src="./../../img/min.png"></image>
       <view class="top_text">木鱼</view>
     </view>
@@ -14,7 +21,7 @@
     <view class="top_item">
       <image class="device_pic" mode="heightFix" src="./../../img/min.png"></image>
       <view class="top_text">曲谱</view>
-    </view>
+    </view> -->
   </view>
 
 </view>

+ 8 - 5
pages/detail/detail.wxss

@@ -1,22 +1,25 @@
-.top_item_public {
+.top_item_public_add {
   display: flex;
   margin-top: 50rpx;
   /*  垂直布局 */
   /* flex-direction: column; */
-  /*  水平居中 */
-  align-items: center;
   /* 垂直居中 */
+  /* justify-content: center; */
+}
+
+.top_item_public {
+  display: flex;
+  flex: 1;
   justify-content: center;
 }
 
 .top_item {
-  flex: 1;
   display: flex;
   align-items: center;
   flex-direction: column;
 }
 
-.device_pic {
+.top_image {
   height: 70rpx;
 }
 

+ 2 - 2
project.private.config.json

@@ -9,8 +9,8 @@
     "miniprogram": {
       "list": [
         {
-          "name": "pages/detail/detail",
-          "pathName": "pages/detail/detail",
+          "name": "pages/piano/detail/detail",
+          "pathName": "pages/piano/detail/detail",
           "query": "",
           "launchMode": "default",
           "scene": null