App.js写逻辑内容,内置有函数,有三大作用
查看options的scene值
场景值对应的方式
onShow: function (options) {
console.log(options)
}
onLaunch: function (options) {
wx.getUserInfo({
success:function (res) {
console.log(res)
}
})
},
<button size="mini" open-type="getUserInfo" bindgetuserinfo="handleGetUserInfor">确定授权</button>
.js
handleGetUserInfor(event){
console.log(event);
}
<open-data type="userAvatarUrl"></open-data>
App.js
globleData:{
name:'溜溜',
age:14
}
user.js
const data = getApp();
console.log(data.globleData.name);