时间:2019-05-04 来源:小程序工厂
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()
本文网址:http://www.91bianli.com/weixinxiaochengxu/51964.html