zheng 1 өдөр өмнө
parent
commit
d44ce5b14d

+ 24 - 9
12.小程序/pages/home/home.js

@@ -15,60 +15,75 @@ Page({
     }],
     score: 87
   },
-
+  showHi() {
+    console.log("你好")
+  },
+  showHello() {
+    console.log("哈哈哈")
+  },
+  showMain1() {
+    console.log(1)
+  },
+  showMain2(event) {
+    // console.log(event)
+    console.log(2)
+  },
+  handleInp() {
+    console.log("00")
+  },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    console.log(1)
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady() {
-
+    console.log(2)
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
   onShow() {
-
+    console.log(3)
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
   onHide() {
-
+    console.log(4)
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
   onUnload() {
-
+    console.log(5)
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh() {
-
+    console.log(6)
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom() {
-
+    console.log(7)
   },
 
   /**
    * 用户点击右上角分享
    */
   onShareAppMessage() {
-
+    console.log(8)
   }
 })

+ 2 - 1
12.小程序/pages/home/home.json

@@ -1,3 +1,4 @@
 {
-  "usingComponents": {}
+  "usingComponents": {},
+  "enablePullDownRefresh": true
 }

+ 10 - 3
12.小程序/pages/home/home.wxml

@@ -1,6 +1,7 @@
 <!--pages/home/home.wxml-->
 <view>
-  <text class="title">首页</text>
+<!-- tap click -->
+  <text class="title" bind:tap="showHi">首页</text>
   <!-- 模版渲染 -->
   <view>今天是{{day}}</view>
   <!-- 条件渲染 -->
@@ -8,8 +9,14 @@
   <view wx:if="{{score >= 90}}">优秀</view>
   <view wx:elif="{{score > 60}}">及格</view>
   <view wx:else="{{score < 60}}">不及格</view>
-  <button>你好</button>
-  <input type="text" />
+  <!-- @click v-bind:click -->
+  <button class="main" catch:tap='showHello'>你好</button>
+  <!-- bindconfirm bindtap bindInput -->
+  <input type="text" bindinput="handleInp"  />
+  <view class="box1" bind:tap="showMain1">
+    <view class="box2" catch:tap="showMain2"></view>
+  </view>
+  
   <template name="hi">
     <text>hello,今天星期日</text>
     <view>成绩:{{score}}</view>

+ 3 - 1
12.小程序/pages/home/home.wxss

@@ -1,4 +1,6 @@
 /* pages/home/home.wxss */
+@import './test.wxss';
 .title {
-  color: #f00
+  color: #f00;
+  font-size: 30rpx;
 }

+ 13 - 0
12.小程序/pages/home/test.wxss

@@ -0,0 +1,13 @@
+.main {
+  color: #00f;
+}
+.box1 {
+  width: 300rpx;
+  height: 300rpx;
+  background: #00f;
+}
+.box2 {
+  width: 150rpx;
+  height: 150rpx;
+  background: #ff0;
+}