收藏
回答

小程序xml2json类库window.ActiveXObject错误

使用外库 https://github.com/abdmob/x2js 解析xml2json.

在web端正常,移植到小程序就报错了。错误如下:


thirdScriptError

Cannot read property 'ActiveXObject' of undefined;at api getLocation success callback function

TypeError: Cannot read property 'ActiveXObject' of undefined

    at Object.parseXmlString (http://1074917368.appservice.open.weixin.qq.com/utils/xml2json.js:425:27)

    at Object.xml_str2json (http://1074917368.appservice.open.weixin.qq.com/utils/xml2json.js:481:22)

    at Object.SearchParkInfo (http://1074917368.appservice.open.weixin.qq.com/app.js:31:36)

    at Function.success (http://1074917368.appservice.open.weixin.qq.com/app.js:44:17)

    at Object.success (http://1074917368.appservice.open.weixin.qq.com/WAService.js:3:6898)

    at http://1074917368.appservice.open.weixin.qq.com/WAService.js:4:8110

    at Object.u [as 0.16555421337887521] (http://1074917368.appservice.open.weixin.qq.com/asdebug.js:1:14219)

    at i (http://1074917368.appservice.open.weixin.qq.com/asdebug.js:1:13547)

    at p (http://1074917368.appservice.open.weixin.qq.com/asdebug.js:1:4336)

    at http://1074917368.appservice.open.weixin.qq.com/asdebug.js:1:5158


请问我该怎么解决啊?谢谢各位。

回答关注问题邀请回答
收藏

2 个回答

  • 周二分
    周二分
    2018-01-29

    你解决了这个问题了么,怎么解决的

    2018-01-29
    有用
    回复
  • Ray
    Ray
    2017-01-12

    页面的脚本逻辑是在JsCore中运行,JsCore是一个没有窗口对象的环境,所以不能在脚本中使用window,也无法在脚本中操作组件https://mp.weixin.qq.com/debug/wxadoc/dev/qa.html?t=201715 最好把官方文档多看几遍

    2017-01-12
    有用
    回复
登录 后发表内容