问题描述
我在网站构建中遇到问题,该页面在IE11中无法正确显示.该站点可以在chrome,firefox和edge中正确显示.
I am having issues with a site build where the page is not displaying properly in IE11. The site displays correctly in chrome, firefox, and edge.
该错误似乎破坏了该错误文件中的所有javascript.该文件负责处理布局的某些部分,因此,如果文件失败,则会导致页面上的各个部分无法正确呈现.
The error seems to break all the javascript from the file of the error. The file is responsible for handling parts of the layout, so when it fails it causes various sections on the page to not render properly.
错误消息是" Script1010 ",并指向以下代码行:
The error message is "Script1010" and points to the following line of code:
function animate({ draw, duration }) {
...
}
我无法确定IE无法处理此行的原因.我所看到的最能回答的问题是以下提示"draw"或"duration"可能是IE中的保留字.但是更改它们会导致相同的错误发生.
I've not been able to identify why IE cannot process this line. The closest thing to answer I've seen is the following post that suggests that "draw" or "duration" might be reserved words in IE. But changing them caused the same error to occur.
有什么建议或建议吗?
感谢您的答复.想通了,我将把这个问题作为类似搜索甚至甚至是我自己的脚注加以澄清.如下所述,问题归结为"IE是否支持ES6对象解构?".事实证明,对象分解在IE中不起作用.
Thanks for the replies. Figured I would clarify the question as a foot note for similar searches, or even just for myself. As pointed out below, the question boils down to "Does IE support ES6 object destructuring?". Turns out object destructuring does not work in IE.
推荐答案
您正在使用ES6解构参数.Internet Explorer不支持ES6.
You are using ES6 to destructure the arguments. Internet Explorer does not support ES6.
您要么必须使用ES5重写它,要么使用 Babel 之类的编译器将代码转换为ES5
You'll either have to rewrite it using ES5 or use a transpiler like Babel to transpile your code into ES5.
如果这是ES6的唯一出现,我建议重写它,否则我将使用Babel.
If this is the only occurrence of ES6, I'd suggest rewriting it, but otherwise I'd use Babel.
function animate(arg) {
var draw = arg.draw
var duration = arg.duration
...
}
这篇关于函数animate({draw1,duration1}){...导致IE11中预期的标识符(script1010)错误-IE中的对象分解支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!