nuxt.js 开发兼容ie浏览器的es6 转码

安装

  1. npm install babel-polyfill -s

引入 polyfill

  1. // plugins/ployfill.js
  2. import 'babel-polyfill';

配置config.js

  1. // config.js
  2. plugins: [
  3. {
  4. src: '@/plugins/polyfill'
  5. }
  6. ]

跟目录下创建 .babelrc

  1. // .babelrc文件
  2. {
  3. "presets": [
  4. "es2015","stage-0","stage-3"
  5. ]
  6. }