微信小程序踩坑集
时间:2017-08-07 16:38:55
收藏:0
阅读:291
setData function is not defined 这个问题只会出现在
wx.request(OBJECT)中
具体替代吗吧!写日志真的不是我的强项
//logs.js var util = require(‘../../utils/util.js‘) Page({ data: { logs: [], array: [] }, onLoad: function () { var that = this this.setData({ logs: (wx.getStorageSync(‘logs‘) || []).map(function (log) { return util.formatTime(new Date(log)) }) }), wx.request({ url: ‘http://www.micuer.com/xiaochengxu.php‘, data: { x: ‘1‘, y: ‘1‘ }, header: { ‘content-type‘: ‘application/json‘ }, success: function (res) { that.setData({array : res.data.data }) wx.showToast({ title: ‘成功‘ + res.data.msg, icon: ‘success‘, duration: 2000 }) } }) } })
评论(0)