JSON.stringify() not a function 解决办法
2019-08-15 17:24
2975 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_43412215/article/details/99643924
今天在项目中遇到一个BUG,
JSON.stringify() not a function ,改为window.JSON.stringify()就解决
直接贴代码:
async preBtn() { let meRdata = await this.doSomeThing(); let data = {} Object.assign(data,this.form,meRdata) sessionStorage.setItem('home_data',JSON.stringify(data)) }
这里博主想要写一个点击事件,在触发的时候发一个请求,将返回的数据和另一个数据合并,最后转为json后,存在sesstion中,但是报JSON.stringify() is not a function ,但是能够直接打印出来JSON,一直找不到原因,最后改为window.JSON.stringify()就好了,在写这个博客的时候我又去试了这个BUG,但是怎么都重新不了,希望有大佬能够解答一下。
相关文章推荐
- $ is not a function解决办法
- C++开发python扩展模块:ImportError: dynamic module does not define init function (initRabbit)解决办法
- uploadify动态更新配置参数方法uploadifySettings()报错“updateSettings is not a function”之解决办法
- The function getUserId must be used with a prefix when a default namespace is not specified 解决办法
- TypeError: datetime.datetime(2016, 9, 25, 21, 12, 19, 135649) is not JSON serializable解决办法(json无法序列化对象的解决办法)
- Android之error: void value not ignored as it ought to be(In function 'callMethod2')解决办法
- python2.7web代码用python3.6运行时,浏览器发送请求报错TypeError: Object of type 'bytes' is not JSON serializable的解决办法
- Uncaught TypeError: $.cookie is not a function 解决办法
- 使用toFixed()函数时,出现“toFixed() is not a function”的解决办法
- $.cookie is not a function;原因及解决办法
- Python json中的Object of type "xxx" is not JSON serializable通用解决办法
- Controller返回值JSON串化失败,HttpMessageNotWritableException异常解决办法
- 出现value.locale is not a function问题解决办法
- This application has not been initialized with an ESRI license and will not function correctly 解决办法
- parser.parse is not a function——arcgis api报错解决办法
- angular 1.6 $http.get(...).success is not a function 解决办法
- $.cookie is not a function;原因及解决办法
- warning: the 'gets' function is dangerous and should not be used.的解决办法
- 使用toFixed()函数时,出现“toFixed() is not a function”的解决办法
- 形如 JSONObject["xx"] is not a JSONArray的解决办法