11// pages/home/home.js
22Page ( {
3-
4- /**
5- * 页面的初始数据
6- */
73 data : {
8-
4+ titles : [ '衣服' , '裤子' , '鞋子' ]
95 } ,
10-
11- /**
12- * 生命周期函数--监听页面加载
13- */
14- onLoad : function ( options ) {
15-
6+ handleBtnClick ( ) {
7+ console . log ( '按钮发生点击' )
168 } ,
17-
18- /**
19- * 生命周期函数--监听页面初次渲染完成
20- */
21- onReady : function ( ) {
22-
9+ handleTouchStart ( ) {
10+ console . log ( 'handleTouchStart' )
2311 } ,
24-
25- /**
26- * 生命周期函数--监听页面显示
27- */
28- onShow : function ( ) {
29-
12+ handleTouchMove ( ) {
13+ console . log ( 'handleTouchMove' )
3014 } ,
31-
32- /**
33- * 生命周期函数--监听页面隐藏
34- */
35- onHide : function ( ) {
36-
15+ handleTouchEnd ( ) {
16+ console . log ( 'handleTouchEnd' )
3717 } ,
38-
39- /**
40- * 生命周期函数--监听页面卸载
41- */
42- onUnload : function ( ) {
43-
18+ handleTap ( ) {
19+ console . log ( 'handleTap' )
4420 } ,
45-
46- /**
47- * 页面相关事件处理函数--监听用户下拉动作
48- */
49- onPullDownRefresh : function ( ) {
50-
21+ handleLongpress ( ) {
22+ console . log ( 'handleLongpress' )
5123 } ,
52-
53- /**
54- * 页面上拉触底事件的处理函数
55- */
56- onReachBottom : function ( ) {
57-
24+ handleEventClick ( event ) {
25+ console . log ( '-------' , event )
26+ } ,
27+ handleEventEnd ( event ) {
28+ console . log ( '+++++++' , event )
29+ } ,
30+ handleInner ( event ) {
31+ console . log ( event )
32+ } ,
33+ handleOuter ( event ) {
34+ console . log ( event )
35+ } ,
36+ handleItemClick ( event ) {
37+ console . log ( event )
38+ // title - index
39+ const dataset = event . currentTarget . dataset ;
40+ const title = dataset . item ;
41+ const index = dataset . index ;
42+ console . log ( title , index )
5843 } ,
5944
60- /**
61- * 用户点击右上角分享
62- */
63- onShareAppMessage : function ( ) {
64-
45+ // ---------- 事件冒泡和事件捕获
46+ handleCaptureView1 ( ) {
47+ console . log ( 'handleCaptureView1' )
48+ } ,
49+ handleBindView1 ( ) {
50+ console . log ( 'handleBindView1' )
51+ } ,
52+ handleCaptureView2 ( ) {
53+ console . log ( 'handleCaptureView2' )
54+ } ,
55+ handleBindView2 ( ) {
56+ console . log ( 'handleBindView2' )
57+ } ,
58+ handleCaptureView3 ( ) {
59+ console . log ( 'handleCaptureView3' )
60+ } ,
61+ handleBindView3 ( ) {
62+ console . log ( 'handleBindView3' )
6563 }
66- } )
64+ } )
0 commit comments