1、配置 .browserslistrc
> 1%
last 4 versions
2、安装babel-polyfill依赖
npm install babel-polyfill --save-dev
在vue.config.js中引入babel-polyfill
chainWebpack: config => {
config.entry.app = ["babel-polyfill", resolve('src/main.js')],
config.resolve.alias
.set('@', resolve('src'))
.set('./@assets', resolve('src/assets'))
.set('@components', resolve('src/components'))
.set('@store', resolve('src/store'))
.set('@utils', resolve('src/utils'))
.set('@serviceSupervision', resolve('src/components/pages/serviceSupervision'))
.set('@onlineRevision', resolve('src/components/pages/onlineRevision'))
.set('@evaluate', resolve('src/components/pages/evaluate'))
.set('@TablesAndChairs', resolve('src/components/pages/TablesAndChairs'))
.set('@font', resolve('src/font'));
}
在babel.config.js中引入配置
module.exports = {
presets: [
['@vue/app', {
polyfills: [
'es6.promise',
'es6.symbol'
]
}]
]
}
配置完之后在ie中打开会出现空白现象,在打开控制台的情况下,在刷新就会出现页面了,对于这个问题是ie的控制台脚本保护机制,我们需要重新定义console.log:
在加载的index.html,对console做判断(放在<body>标签前面)
<script type="text/javascript">
if(!window.console){
window.console = {};
}
if (!window.console.log) {
window.console.log = function(msg){ };
}
</script>
网友评论