- 分页加载数据添加问题
//首次取出数据 if (that.data.panduan) { jieguo1 = data.data.song.list} //取出后添加数据 else { jieguo1 = (that.data.jiegou).concat(data.data.song.list)} 控制台能成功接收到返回的信息,但是执行else的时候错误了是怎么回事,进不去else赋值。 {code: 0, data: {…}, message: "", notice: "", subcode: 0, …}code: 0data: keyword: "周杰伦"priority: 0qc: []semantic: {curnum: 0, curpage: 2, list: Array(0), totalnum: 0}song: curnum: 15curpage: 2list: Array(15) 错误信息提示在下面。说concat未定义。我还是不知道错误的地方在哪里 WAService.js:3 thirdScriptError Cannot read property 'concat' of undefined;at App getInfo function;at api request success callback function TypeError: Cannot read property 'concat' of undefined
2018-01-04 - 分页加载问题求教
<scroll-view scroll-y="true" bindscrolltolower="scrolltolower" style="height:500px"></scroll-view>这是wxml页面创建的下拉事件, scrolltolower : function () { var that = this if ((that.data.load) && (!that.data.complete)) { that.setData({ shouijiazai:that.data.shouijiazai+1, //每次触发上拉事件,把searchPageNum+1 panduan: false //触发到上拉事件,把isFromSearch设为为false }); that.ABC(); } } 这是JS里面的事件方法,为什么就是不触发啊。下拉没作用,下拉加载的数据出不来是怎么回事。这个事件不能触发~?求解
2018-01-04 - 问个问题,网络请求的
function getSearchMusic(keyword, pageindex, callbackcount, callback){ wx.request({ url: 'https://c.y.qq.com/soso/fcgi-bin/search_for_qq_cp', data: { g_tk: 5381, uin: 0, format: 'json', inCharset: 'utf-8', outCharset: 'utf-8', notice: 0, platform: 'h5', needNewCode: 1, w: keyword, zhidaqu: 1, catZhida: 1, t: 0, flag: 1, ie: 'utf-8', sem: 1, aggr: 0, perpage: 20, n: callbackcount, //返回数据的个数 p: pageindex, remoteplace: 'txt.mqq.all', _: Date.now() }, method: 'GET', header: {'content-Type': 'application/json'}, success: function(res){ if(res.statusCode == 200){ callback(res.data); } } }) } module.exports = { getSearchMusic: getSearchMusic } 这是封装的一个网络请求的代码,是关于QQ音乐歌曲搜索的,有一个问题就是data里面写的那么多参数都是什么东西啊,是必须写的吗,还有我传入的三个参数对应的w,n,p是什么意思,为什么我改了前面的w,n,p就不能成功获取数据,就是 n:callbcakcount p: pageindex, w: keyword, 这3个是什么意思,n.w.p 代表什么,换成别的字母怎么错误了?
2018-01-03 - 小白求指教个问题
最近在学习做一个电影的demo,遇到一个问题有点不解,就是返回数据的加载分页问题这个不知道怎么实现,还有简单封装网络请求的时候有点不理解,封装网络请求的时候,wx.request里面的data部分写的是什么。小白有点愚昧,最好是给个具体的案例会好理解很多。谢谢
2018-01-01