小程序

0.脚手架

npm install -g wepy-cli

1.生命周期:

onLoad  监听页面加载

onShow 监听页面显示

onReady 监听页面初次渲染完成

onHide 监听页面隐藏

2.转发按钮

自定义内容函数

onShareAppMessage:function(){

    return{

      title:'不转不是中国人',

      pata:'/pages/login/login',

      imageUrl:'/image/1.jpg'

    }

  }

3.绑定输入框

获取输入内容

bind:function(e){

    console.log(e.detail.value)

  }

4.绑定参数

点击

获取参数

tab:function(e){

   console.log(e.currentTarget.dataset)

  },

5.上拉函数

onPullDownRefresh:function(){

    console.log("下拉刷新")

  },

6.下拉函数

onReachBottom:function(){

    console.log("上拉刷新")

  },

7.渲染数据

数据

brand:[

      { name: "苹果", phone: ["phone4", "phone5", "phone6", "phone7"]},

      { name: "华为", phone: ["p10", "p11", "p12", "p13"]},

      { name: "小米", phone: ["小米1", "小米2", "小米3", "小米4"]}

    ],

渲染

  {{item.name}}

 

  wx:for-index="subindex" wx:key="{{subindex}}">

  {{sub}}

 

8.判断

买:{{iphonex.name}},价格:{{iphonex.price}}

买:{{iphone8.name}},价格:{{iphone8.price}}

买:{{iphone6.name}},价格:{{iphone6.price}}

你可能感兴趣的:(小程序)