在IE浏览器访问vue项目,报错:vuex requires a Promise polyfill in this browser

  • 第一步: 安装 babel-polyfill 。 babel-polyfill可以模拟ES6使用的环境,可以使用ES6的所有新方法
    npm install --save babel-polyfill

  • 第二步: 在 Webpack/Browserify/Node 中使用
    /build/webpack.base.config.js 文件中,找到以下代码:

module.exports = {
    entry: {
        app: './src/main.js'
    }
}

并把它替换为:

module.exports = {
    entry: {
        app: ['babel-polyfill', './src/main.js']
    }
}

猜你喜欢

转载自blog.csdn.net/Robin_star_/article/details/81254544