IE/Microsoft Edge上的Vue JS呈现错误 [英] Vue JS render error on IE / Microsoft Edge
问题描述
该页面在IE 11和Microsoft Edge以外的所有浏览器上均正确加载.我看到的唯一错误是"SCRIPT1028:SCRIPT1028:预期的标识符,字符串或数字chunk-vendors.8615b873.js(1407,41419)".代码:
The page is loading correctly on every browser except IE 11 and Microsoft Edge. The only error that i can see is "SCRIPT1028: SCRIPT1028: Expected identifier, string or number chunk-vendors.8615b873.js (1407,41419)". The code:
this.form.addEventListener("submit",async e=>{
try{
this.$emit("loading",!0),e.preventDefault();
const{
,error:n
}=await this.$stripe.createToken({...this.card,amount:1e3});
推荐答案
使用 {... obj}
此线程和
Does the error point to the line using { ...obj }
object rest/spread properties? The syntax is a part of ECMAScript 2018 which is not supported by Edge Legacy and IE. You could also refer to this thread and this thread which have similar issues.
您需要使用 Babel 进行转译它.通过运行以下命令安装 @ babel/plugin-proposal-object-rest-spread
You need to use Babel to transpile it. Install @babel/plugin-proposal-object-rest-spread by running:
npm install --save-dev @babel/plugin-proposal-object-rest-spread
然后根据用法将其作为插件包含在内.
这篇关于IE/Microsoft Edge上的Vue JS呈现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!