1. 更新Json数据
var self = this
self.setData({
hasLogin: true
})
that.update()
2. 网络请求
wx.request({
url: '',
data: {},
method: 'GET',
header: { 'content-type': 'application/json' },
success: function (res) {
var datas= res.data
},
fail: function () {},
complete: function () {}
})
3. 加载
//显示加载框
wx.showLoading({
title: '加载中',
})
//隐藏加载框
wx.hideLoading()
4. bindtap点击事件传值
data-tag自定义参数传参
<text data-tag="{
{item.tag}}" id="{
{item.tag}}" bindtap='checkPage'>{
{item.value}}</text>
//实现
checkPage: function(event) {
var newTagId = event.target.id;
var tag = event.target.dataset.tag;
console.log("newTagId = " + newTagId)
console.log("tag = " + tag)
}
5. 跳转
wx.navigateTo({
url: './addresume/addresume?name=' + name + '&openId=' + openId,
})
wx.navigateTo({
url: '../welfare/addresume/addresume',
})
PS:注意url 两者的文件位置关系,以上两种写法都可达到目的
拓展分析:‘./’ 为当前目录下 ‘…/’则为当前目录的上级目录 ,’/'则为当前目录的下的某个目录
pages/welfare/welfare.js
pages/welfare/addresume/addresume.js
6. toast
wx.showToast({
title: '复制