0

我们使用 aurelia 框架创建了单页应用程序。我们es7 decorators在 aurelia 应用程序中使用。该应用程序在 chrome 和 firefox 中运行良好,但在 IE 9,10 中无法运行。但它在 IE 11 中可以正常工作。

浏览器控制台显示错误"Unhandled promise rejectionError"

我们如何解决这个问题?

4

1 回答 1

2

直接取自应用程序配置和启动页面内的文档本身。

Aurelia 最初是为 Evergreen 浏览器设计的。这包括 Chrome、Firefox、IE11 和 Safari 8。但是,我们也通过使用额外的 polyfill 来支持 IE9 及更高版本。为了支持这些早期的浏览器,你需要为 MutationObservers 添加一个额外的 polyfill。这可以通过 github:polymer/mutationobservers 的 jspm 安装来实现。然后改变你的 index.html 启动代码如下:

Polyfill 配置

<!doctype html>
<html>
  <head>
    <title>My App</title>
  </head>
  <body>
    <script src="jspm_packages/system.js"></script>
    <script src="config.js"></script>
    <script>
      SystemJS.import('core-js').then(function() {
        return SystemJS.import('polymer/mutationobservers');
      }).then(function() {
        SystemJS.import('aurelia-bootstrapper');
      });
    </script>
  </body>
</html>
于 2016-04-11T04:34:54.780 回答