[Vue warn]: Error in mounted hook: "ReferenceError: Can't find variable: Promise"
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Vue warn]: Error in mounted hook: "ReferenceError: Can't find variable: Promise"相关的知识,希望对你有一定的参考价值。
参考技术A 现有一个vue项目,在中使用了axios.get获取本地json文件:在java项目中使用phantomjs调用vue静态页面:
报错:
无头浏览器PhantomJS,并不支持Promise函数
首先,vue项目安装es6-promise:
然后,在js文件中引入 es6-promise,并执行 polyfill 方法
ok,完美。
参考: https://www.npmjs.com/package/es6-promise
[Vue warn]: Error in render: "SyntaxError: Unexpected token ' in JSON at position 1"
一,场景:
字符串转对象;
var str = "{‘bankRate‘:5,‘YINGUO‘:0}"
二,操作:
JSON.parse(str)时候,报错
[Vue warn]: Error in render: "SyntaxError: Unexpected token ‘ in JSON at position 1"
三,原因:
使用parse这个方法,要求很严格,必须是json的k和value都用双引号包起来;
ex:"{"bankRate":5,"YINGUO":0}"
四,解决方案:不用parse,选择用eval()
以上是关于[Vue warn]: Error in mounted hook: "ReferenceError: Can't find variable: Promise"的主要内容,如果未能解决你的问题,请参考以下文章
Vue(踩坑)vue.esm.js?efeb:628 [Vue warn]: Error in render: "TypeError: Cannot read property '0
[Vue warn]: Error in mounted hook: "ReferenceError: Can't find variable: Promise"
uni-app的Vue项目中Echarts的报错提示:[Vue warn]: Error in data(): “ReferenceError: echarts is not defined“
[Vue warn]: Error in created hook: “TypeError: Cannot read properties of undefined (reading ‘$on‘)“
[Vue warn]: Error in render: "TypeError: Cannot read property '0' of undefined
[Vue warn]: Error in nextTick: “TypeError: Right-hand side of ‘instanceof‘ is not an object“