Browse Source

小程序

zheng 4 ngày trước cách đây
mục cha
commit
639405d7fb

+ 2 - 1
12.小程序/app.json

@@ -4,7 +4,8 @@
     "pages/index/index",
     "pages/logs/logs",
     "pages/list/list",
-    "pages/my/my"
+    "pages/my/my",
+    "pages/detail/detail"
   ],
   "window": {
     "navigationBarTextStyle": "white",

+ 66 - 0
12.小程序/pages/detail/detail.js

@@ -0,0 +1,66 @@
+// pages/detail/detail.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
12.小程序/pages/detail/detail.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 2 - 0
12.小程序/pages/detail/detail.wxml

@@ -0,0 +1,2 @@
+<!--pages/detail/detail.wxml-->
+<text>pages/detail/detail.wxml</text>

+ 1 - 0
12.小程序/pages/detail/detail.wxss

@@ -0,0 +1 @@
+/* pages/detail/detail.wxss */

+ 21 - 0
12.小程序/pages/home/home.js

@@ -45,6 +45,27 @@ Page({
   getUser:function() {
     console.log(wx.getStorageSync('user'))
   },
+  goDetail:function() {
+    console.log("触发")
+    wx.navigateTo({
+      url: '/pages/detail/detail',
+    })
+  },
+  goDetail1:function() {
+    wx.redirectTo({
+      url: '/pages/detail/detail',
+    })
+  },
+  goMy:function() {
+    wx.switchTab({
+      url: '/pages/my/my',
+    })
+  },
+  goMy2:function() {
+    wx.reLaunch({
+      url: '/pages/detail/detail',
+    })
+  },
   /**
    * 生命周期函数--监听页面加载
    * 页面加载时触发 一个页面只会调用一次

+ 5 - 0
12.小程序/pages/home/home.wxml

@@ -8,6 +8,11 @@
   <van-button type="warning">警告按钮</van-button>
   <van-button type="danger">危险按钮</van-button>
   <headers></headers>
+  <navigator url="/pages/detail/detail">前往详情</navigator>
+  <view bind:tap="goDetail">去详情1</view>
+  <view bind:tap="goDetail1">去详情2</view>
+  <view bind:tap="goMy">去我的</view>
+  <view bind:tap="goMy2">去我的</view>
   <view>哈哈哈哈</view>
   <template name="aa">
     <text>这是首页内容</text>

+ 9 - 2
12.小程序/project.private.config.json

@@ -24,11 +24,18 @@
     "miniprogram": {
       "list": [
         {
-          "name": "pages/home/home",
-          "pathName": "pages/home/home",
+          "name": "pages/detail/detail",
+          "pathName": "pages/detail/detail",
           "query": "",
           "scene": null,
           "launchMode": "default"
+        },
+        {
+          "name": "pages/home/home",
+          "pathName": "pages/home/home",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
         }
       ]
     }