data:{schoolId:' '}
schoolInput: function (e) { //这里是前端input注册的监听
this.setData({schoolId: e.detail.value})} //获取你前端input输入的值,此处作为筛选的条件
seeItem: function(e) {
var _this = this // success代码块中封闭,无法使用this.data调用
var name = this.data.schoolId
首先就是发送请求获取json数据
wx.request({
url: '这里填写你要获取json数据的地址',
method: 'get',
headers: {
'Content-Type': 'application/json'
},
success(res) { //成功的话,直接就在本地对数据进行缓存
wx.setStorage({
key: 'schoolInfo',
data: res.data
})
wx.reLaunch({ //跳转的页面
url: '/pages/items/items',
})
} })
这是跳转页面对应的js即