1.安装插件
npm i @babel/polyfill -S
2. 在main.js中引入(第一行)
import "@babel/polyfill";
3.在vue.config.js
3.1
// 配置IE兼容
configureWebpack: config => {
//引入babel-polyfill'模块
//config.entry.app = ["babel-polyfill", "./src/main.js"]
config.entry.app = ["@babel/polyfill", "./src/main.js"]
},
3.2
chainWebpack: config => {
config.module
.rule('view-design')
.test(/view-design.src.*?js$/)
.use('babel')
.loader('babel-loader')
.end()
}
- 如果还是不行,就选择通过npm下载 babel-polyfill
- 然后重复上面的3.1步骤
借鉴:借鉴