kay
kay
  • 发布:2017-07-19 18:56
  • 更新:2017-07-19 19:03
  • 阅读:4754

用Hbuilder的控制台如何输出像chrome一样的对象结构

分类:HBuilder

在用Hbuilder开发手机APP的时候想输出一下某个对象的结构,但是输出的只能是[object Object]这种东西
能不能像chrome的开发者工具中一样,直接把对象的结构输出出来,比如obj{a:1,b:2}这种的?我用的是console.log,试了什么console.dir也不行~

2017-07-19 18:56 负责人:无 分享
已邀请:
王者地带

王者地带 - 5+混合APP开发教程网 | http://www.html5-app.com | 咨询QQ: 2564034335

加上: JSON.stringify(plus); 试下

  • kay (作者)

    console.log(JSON.stringify(plus));是这样吗?是了报错

    Uncaught Error: INVALID_STATE_ERR: DOM Exception 11 at index.html:547

    2017-07-19 19:12

  • 王者地带

    可以打印出来,

    console.log("显示:"+JSON.stringify(plus));


    显示:{"isReady":true,"tools":{"UUID":12,"UNKNOWN":-1,"IOS":0,"ANDROID":1,"platform":1,"debug":false},"bridge":{"NO_RESULT":0,"OK":1,"CLASS_NOT_FOUND_EXCEPTION":2,"ILLEGAL_ACCESS_EXCEPTION":3,"INSTANTIATION_EXCEPTION":4,"MALFORMED_URL_EXCEPTION":5,"IO_EXCEPTION":6,"INVALID_ACTION":7,"JSON_EXCEPTION":8,"ERROR":9,"callbacks":{"plus21500462917342":{},"plus41500462917352":{},"plus61500462917611":{},"plus81500462917656":{},"plus101500462917716":{},"plus111500462918186":{}},"commandQueue":[],"isInEvalJs":0,"synExecXhr":{"response":"","responseText":""},"execIframe":null,"execImg":null},"obj":{},"accelerometer":{},"audio":{"ROUTE_SPEAKER":0,"ROUTE_EARPIECE":1},"barcode":{"QR":0,"EAN13":1,"EAN8":2,"AZTEC":3,"DATAMATRIX":4,"UPCA":5,"UPCE":6,"CODABAR":7,"CODE39":8,"CODE93":9,"CODE128":10,"ITF":11,"MAXICODE":12,"PDF417":13,"RSS14":14,"RSSEXPANDED":15},"cache":{},"camera":{},"console":{},"contacts":{"ADDRESSBOOK_PHONE":0,"ADDRESSBOOK_SIM":1},"downloader":{"taskList":[]},"gallery":{"galleryStatus":0,"onPickImageFinished":null},"geolocation":{"lastPosition":null},"io":{"PRIVATE_WWW":1,"PRIVATE_DOC":2,"PUBLIC_DOCUMENTS":3,"PUBLIC_DOWNLOADS":4},"maps":{"MapType":{"MAPTYPE_SATELLITE":"MAPTYPE_SATELLITE","MAPTYPE_NORMAL":"MAPTYPE_NORMAL"},"SearchPolicy":{"TRANSIT_TIME_FIRST":"TRANSIT_TIME_FIRST","TRANSIT_TRANSFER_FIRST":"TRANSIT_TRANSFER_FIRST","TRANSIT_WALK_FIRST":"TRANSIT_WALK_FIRST","TRANSIT_FEE_FIRST":"TRANSIT_FEE_FIRST","DRIVING_TIME_FIRST":"DRIVING_TIME_FIRST","DRIVING_NO_EXPRESSWAY":"DRIVING_NO_EXPRESSWAY","DRIVING_FEE_FIRST":"DRIVING_FEE_FIRST"},"bridge":{"callback":[]}},"messaging":{"TYPE_SMS":1,"TYPE_MMS":2,"TYPE_EMAIL":3},"ui":{"nviews":{}},"orientation":{},"payment":{},"push":{},"runtime":{"arguments":"","version":"8.8.0","innerVersion":"1.9.9.32474","launchLoadedTime":"null","launcher":"default","origin":"default","processId":"1965","startupTime":"","appid":"HBuilder","channel":""},"share":{},"speech":{},"statistic":{},"storage":{},"uploader":{"taskList":{}},"widget":{},"net":{},"zip":{},"proximity":{},"android":{"Tool":{"undefObjectHash":{}}},"ios":{"Tool":{"undefObjectHash":{}}},"nativeUI":{},"navigator":{"statusBarHeight":22},"key":{},"webview":{"JSON_Window_Stack":{"234717410":{"view_array":[],"IDENTITY":"NWindow","uuid":"234717410","callbacks":{},"callback_id":"plus41500462917352","id":"HBuilder","id":"HBuilder"},"NWindow131500462912951":{"__view_array":[],"IDENTITY":"NWindow","uuid":"NWindow131500462912951","callbacks":{"back":[null],"menu":[null],"show":[null],"hide":[null],"pulldownrefreshevent":[null]},"callback_id":"plus21500462917342","id":"baritemHtml/mine.html","preload":true},"NWindow51500462917611":{"view_array":[],"IDENTITY":"NWindow","uuid":"NWindow51500462917611","callbacks":{},"callback_id":"plus61500462917611","id":"setting.html","preload":true},"NWindow71500462917656":{"view_array":[],"IDENTITY":"NWindow","uuid":"NWindow71500462917656","callbacks":{},"callback_id":"plus81500462917656","id":"viewpag.html","preload":true},"NWindow91500462917716":{"view_array":[],"IDENTITY":"NWindow","uuid":"NWindow91500462917716","callbacks":{},"callback_id__":"plus101500462917716","id":"user-news.html","preload":true}}},"oauth":{},"nativeObj":{},"stream":{},"device":{"imei":"868746025767046,868746025767053","imsi":["460020280760703"],"model":"MX5","vendor":"Meizu","uuid":"868746025767046,868746025767053"},"os":{"language":"zh_CN","version":"5.1","name":"Android","vendor":"Google"},"screen":{"resolutionHeight":640,"resolutionWidth":360,"scale":3,"dpiX":397.565002,"dpiY":403.040985},"display":{"resolutionHeight":640,"resolutionWidth":360},"networkinfo":{"CONNECTION_TYPE":0,"CONNECTION_UNKNOW":0,"CONNECTION_NONE":1,"CONNECTION_ETHERNET":2,"CONNECTION_WIFI":3,"CONNECTION_CELL2G":4,"CONNECTION_CELL3G":5,"CONNECTION_CELL4G":6},"tag__":"onPageFinished"}

    2017-07-19 19:16

  • kay (作者)

    回复 王者地带:我去!为什么我的报错!

    2017-07-19 21:08

该问题目前已经被锁定, 无法添加新回复