babel-core:未捕获TypeError:无法读取未定义的属性'keys'

时间:2018-02-10 09:59:22

标签: javascript babeljs babel babel-core

这是我的index.html

<!DOCTYPE html>
<html lang='ru'>
<head>
  <meta charset='utf-8'/>
  <title>Sandbox</title>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.min.js'></script>
  <script src='js/index.js' type='text/babel'></script>
</head>
<body>
  <div id='foo'></div>
</body>
</html>

这是我的js/index.js文件:

"use strict";

window.onload = function(){
  const stuff = () => document.getElementById('foo').textContent = 'Hello!'
  stuff()
}

打开HTML文件时,我在Google Chrome v64.0.3282.140中收到错误消息:

enter image description here

为什么会这样?

0 个答案:

没有答案