时间:2019-05-07 来源:小程序工厂
reverse方法 了解一下 不吃亏
如果有有分页,你怎么办
看他这个传参 不像有分页呢
好久不见~
出差了一段时间
前端还出差?
我不是前端
老板还出差?
皮~
你好,你说的是api的reverse,好像没有这个api?我查了官网api都没有,想问他是另外包还是怎么了?谢谢
额。。我说的是js里数组的方法
var a = [1,2,3]
a.reverse()
a就变成了 [3,2,1]
哦,是js的api,但是我做了这个api,他系统报错
getExpressInfo: function (nu, cb) {
wx.request({
url: 'https://www.kuaidi100.com/query',
data: {
'type': 'EMS',
'order': 'DESC',
'postid': nu
},
header: {
'content-type': 'application/json'
},
success: function (res) {
res.data.reverse();
cb(res.data);
}
})
},
VM192:1 thirdScriptError
res.data.reverse is not a function;at App getExpressInfo function;at api request success callback function
TypeError: res.data.reverse is not a function
at Function.success (http://127.0.0.1:57464/appservice/app.js:52:18)
at Object.success (http://127.0.0.1:57464/appservice/__dev__/WAService.js:3:13773)
at s.
at s.emit (http://127.0.0.1:57464/appservice/__dev__/WAService.js:4:25864)
at Function.
at http://127.0.0.1:57464/appservice/__dev__/WAService.js:4:8317
at e (http://127.0.0.1:57464/appservice/appservice?t=1539661924460:1129:2597)
at t.
at t.emit (http://127.0.0.1:57464/appservice/appservice?t=1539661924460:1129:4669)
at callback (http://127.0.0.1:57464/appservice/appservice?t=1539661924460:1129:12151)
是不是这个不支持这个api?
js的reverse api,好像不能对对象进行逆转吧?我的那个数组是
var data=[object,object],他就不能逆转了,能指点一下我么,我对js很差刚入行工作,谢谢,麻烦你了,谢谢
是能处理数组,你console.log(res.data)一下呢,哪个是你要反向的数组
[object Object]
那结果就是这样子
console.log(JSON.stringify(res.data))
这个数据是这样子,至于那个data输出是【object,object】
能告诉一下怎么代码么,谢谢,没头绪,谢谢
res.data.data.reverse()
{"message":"ok","nu":"BE732485993DE","ischeck":"1","condition":"D01","com":"ems","status":"200","state":"3","data":[{"time":"2018-10-13 17:22:51","ftime":"2018-10-13 17:22:51","context":"[韶关市]投递并签收,签收人:他人收 值班室","location":null},{"time":"2018-10-13 12:47:04","ftime":"2018-10-13 12:47:04","context":"韶关市南雄市速递物流分公司安排投递,预计23:59:00前投递(投递员姓名:朱江江;联系电话:15219826965)","location":null},{"time":"2018-10-13 08:56:13","ftime":"2018-10-13 08:56:13","context":"离开中国邮政速递物流股份有限公司韶关市邮件处理中心 发往韶关市南雄市速递物流分公司","location":null},{"time":"2018-10-13 06:34:07","ftime":"2018-10-13 06:34:07","context":"到达 中国邮政速递物流股份有限公司韶关市邮件处理中心 处理中心","location":null},{"time":"2018-10-13 01:36:00","ftime":"2018-10-13 01:36:00","context":"离开中山市 发往韶关市(经转)","location":null},{"time":"2018-10-12 22:18:00","ftime":"2018-10-12 22:18:00","context":"[中山市]到达中山三角处理中心处理中心(经转)","location":null},{"time":"2018-10-12 21:14:26","ftime":"2018-10-12 21:14:26","context":"离开江门市 发往中山市","location":null},{"time":"2018-10-12 19:46:35","ftime":"2018-10-12 19:46:35","context":"到达 江门市 处理中心","location":null},{"time":"2018-10-12 18:16:17","ftime":"2018-10-12 18:16:17","context":"已离开中国邮政速递物流股份有限公司江门市跨境电子商务快件,发往中国邮政速递物流股份有限公司江门市邮件处理中心","location":null},{"time":"2018-10-12 15:54:00","ftime":"2018-10-12 15:54:00","context":"中国邮政速递物流股份有限公司江门市跨境电子商务快件已收件(揽投员姓名:容玉燕,联系电话:13828038536)","location":null},{"time":"2018-10-11 09:00:00","ftime":"2018-10-11 09:00:00","context":"[CHINA GUANGZHOU]航班抵达中国","location":null},{"time":"2018-10-10 15:30:00","ftime":"2018-10-10 15:30:00","context":"[GERMANY FRANKFURT]航班已从始发地起飞","location":null},{"time":"2018-10-10 07:39:08","ftime":"2018-10-10 07:39:08","context":"[GERMANY FRANKFURT]到达德国 法兰克福","location":null},{"time":"2018-10-09 00:02:45","ftime":"2018-10-09 00:02:45","context":"[GERMANY FRANKFURT]入库收寄","location":null}]}
本文网址:http://www.91bianli.com/kaifazhinan/74504.html