ant desgin vue 兼容IE9以上配置

vue cli3搭建项目,[email protected]
在babel.config.js文件下加入

安装npm install babel-polyfill --save 或者 cnpm install babel-polyfill --save

module.exports = {
  presets: [
    '@vue/app',
    // 兼容配置
    [
      '@babel/preset-env',
      {
        'useBuiltIns': 'entry'
      }
    ]
  ],
  // 按需加载配置
  plugins: [
    [
      'import',
      {
        libraryName: 'ant-design-vue',
        libraryDirectory: 'es',
        style: 'css'
      },
    ]
  ]
}

vue.config.js文件中加入

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

main.js文件(项目入口)

// 引入"core-js/stable","regenerator-runtime/runtime"处理兼容 
import "core-js/stable";
import "regenerator-runtime/runtime";

import Vue from 'vue'
import App from './App.vue'
import router from './router/router'
import store from './store/store'
import './plugins/antd.js'
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

你可能感兴趣的:(vue)