【问题标题】:Vue JS render error on IE / Microsoft EdgeVue JS render error on IE / Microsoft Edge
【发布时间】:2020-06-26 22:06:54
【问题描述】:

页面在除 IE 11 和 Microsoft Edge 之外的所有浏览器上都能正确加载。我能看到的唯一错误是“SCRIPT1028: SCRIPT1028: Expected identifier, string or number 块供应商.8615b873.js (1407,41419)"。 代码:

this.form.addEventListener("submit",async e=>{
try{
this.$emit("loading",!0),e.preventDefault();
const{
,error:n
}=await this.$stripe.createToken({...this.card,amount:1e3});

【问题讨论】:

  • 对于 IE 11,您应该使用 babel 并将其配置为至少转换 async/await、'...' 运算符和箭头函数。您可以在 caniuse.com 上检查 IE11 中是否正常运行

标签: vue.js internet-explorer npm microsoft-edge


【解决方案1】:

错误是否指向使用{ ...obj }object rest/spread properties 的行?该语法是 ECMAScript 2018 的一部分,Edge Legacy 和 IE 不支持。也可以参考this threadthis thread有类似问题的。

您需要使用Babel 进行转译。通过运行安装 @babel/plugin-proposal-object-rest-spread

npm install --save-dev @babel/plugin-proposal-object-rest-spread

然后根据usage将其包含为插件。

【讨论】:

    猜你喜欢
    • 2021-06-14
    • 2018-03-11
    • 2018-06-22
    • 1970-01-01
    • 2021-11-07
    • 2019-05-31
    • 1970-01-01
    • 2016-03-30
    • 2017-08-21
    相关资源
    最近更新 更多