console.log()打印对象得到[object Object] |
您所在的位置:网站首页 › vue打印对象 › console.log()打印对象得到[object Object] |
问题
调用接口打印时以为会得到该对象里的内容,得到的却是res[object Object] console.log(“res”+res) 原因[object Object]是对象的字符串形式,因为前面是字符串“res”,所以对象res隐式转换成字符串 解决使用如下代码,打印出来的是对象及其属性 console.log('res',res); 补充1:json字符串和json对象的区别 这个是在控制台打印的json对象打印出来的效果分别是:(第一行和第二行是对象) {companyName: null, bindNickName: null, bindAppid: null, id: 1, wxAlias: '', …} {"companyName":null,"bindNickName":null,"bindAppid":null,"id":1,"wxAlias":"","nickName":"多客锦囊","appid":"wx663b04258fca694f","serviceType":2,"bind":false,"wxInfoId":null,"ctime":"2022-04-14 10:04:04","utime":"2022-08-01 16:43:46","dtime":null,"key":1} {companyName: null, bindNickName: null, bindAppid: null, id: 1, wxAlias: '', …} |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |