| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- // pages/home/home.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- name:"图图",
- list:[
- {
- name:"图图",
- age:3
- },
- {
- name:"Lucy",
- age:13
- },
- {
- name:"Tom",
- age:22
- }
- ],
- age: 19,
- background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
- indicatorDots: true,
- vertical: false,
- autoplay: false,
- interval: 2000,
- duration: 500
- },
- handleBox: function() {
- console.log("box")
- },
- handleBox1: function(event) {
- console.log(event,'wwww')
- console.log("box1")
- // event.stopPropagation();
- // event.cancleBubble = true;
- // event.preventDefault();
- // event.returnValue = false;
- },
- handleUser:function() {
- wx.setStorageSync('user', '图图')
- },
- getUser:function() {
- console.log(wx.getStorageSync('user'))
- },
- goDetail:function() {
- console.log("触发")
- wx.navigateTo({
- url: '/pages/detail/detail',
- // url: '/pages/detail/detail?id=123&name=Tom',
- })
- },
- goDetail1:function() {
- let users = {name:"图图",age:3}
- wx.redirectTo({
- url: '/pages/detail/detail?user=' + JSON.stringify(users),
- })
- },
- goMy:function() {
- wx.switchTab({
- url: '/pages/my/my',
- })
- },
- goMy2:function() {
- wx.reLaunch({
- url: '/pages/detail/detail',
- })
- },
- /**
- * 生命周期函数--监听页面加载
- * 页面加载时触发 一个页面只会调用一次
- */
- onLoad(options) {
- console.log("1")
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- * 一个页面只会触发一次
- */
- onReady() {
- console.log("2")
- },
- /**
- * 生命周期函数--监听页面显示
- * 页面显示 切入/切除时触发
- * 触发n次
- */
- onShow() {
- console.log('3')
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- console.log("4");
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- console.log("5")
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- console.log("6")
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|