1. 程式人生 > >微信小程序

微信小程序

pre ole quest fun his new tar ide image

簡易教程  https://mp.weixin.qq.com/debug/wxadoc/dev/

框架(路由)  https://mp.weixin.qq.com/debug/wxadoc/dev/framework/performance.html

api(接口)
https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-map.html#wxcreatemapcontextmapid

前端組件
https://mp.weixin.qq.com/debug/wxadoc/dev/component/video.html

------------------
技術分享


var app = getApp() Page({ data: { motto:
Hello World, userInfo: {} }, //事件處理函數 bindViewTap: function() { wx.navigateTo({ url: ../logs/logs }) }, onLoad: function () { console.log(onLoad) var that = this //調用應用實例的方法獲取全局數據 app.getUserInfo(function(userInfo){ console.dir(userInfo); //更新數據 that.setData({ userInfo:userInfo }) }) } })
-------------------------- 試圖 <view class="container"> <view bindtap="bindViewTap" class="userinfo"> <image class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"></image> <text class="userinfo-nickname">{{userInfo.nickName}}</text> </view> <view class
="usermotto"> <text class="user-motto">{{motto}}</text> </view> </view> ---------------------------------------------- data: { //相當於 display bindViewTap: function() { //相當於類方法 onLoad: function () { //相當於構造函數 bindtap="bindViewTap" //相當於頁面上調用方法的a鏈接 action="{:U(‘news/add‘)}" bindViewTap: function() { wx.navigateTo({ //指定鏈接跳轉地址

發送請求
wx.request({
  url: test.php, //僅為示例,並非真實的接口地址
  data: {
     x: ‘‘ ,
     y: ‘‘
  },
  header: {
      content-type: application/json
  },
  success: function(res) {
    console.log(res.data)
  }
})

技術分享

 

微信小程序