1下载 babel-polyfill 模块
npm install babel-polyfill -s
2入口文件(main.js)第一行引入
import "babel-polyfill";
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Button from 'ant-design-vue/lib/button';
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css';
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN';
import moment from 'moment';
import 'moment/locale/zh-cn';
import './assets/iconfont/iconfont';
import axios from 'axios'
Vue.component(Button.name, Button);
Vue.config.productionTip = false
Vue.use(Antd)
// Vue.use(axios)
moment.locale('zh-cn');
new Vue({
zh_CN,
router,
store,
render: h => h(App)
}).$mount('#app')
3.配置 polyfill,在根目录下新增babel.config.js文件:
module.exports = {
presets: [
['@vue/app', {
useBuiltIns: 'entry'
}]
]
}
原来有此文件就直接修改
module.exports = {
presets: [
// '@vue/cli-plugin-babel/preset', //文件原始内容
['@vue/cli-plugin-babel/preset', {
useBuiltIns: 'entry' //添加的内容
}]
]
}
4.如果设置了以上配置,还是白屏,看是不是兼容性视图问题