VUE CLI-3 项目不适用于 IE-11 [英] VUE CLI-3 Project not working on IE-11
问题描述
我使用 vue-cli3 在 vuejs 中创建了一个项目.它在 chrome 浏览器上运行良好,但在 IE-11 版本的空白屏幕中显示,控制台中显示以下错误,如本链接所述:https://drive.google.com/file/d/1QaNwK1ekI2BwFsFyjvgbSsvwHBCmlcAD/view?usp=drivesdk单击我在上面屏幕截图中指出的控制台错误时,它会打开一个屏幕作为给定链接中的显示 https://drive.google.com/file/d/1_QXVjcw3cmqeC70LfNyLcr__rnXVIZIh/view?usp=drivesdk 在 mini-toastr 包中出现错误:这是我的 babel.config.js 文件代码:
I have created an project in vuejs using vue-cli3. It working fine on chrome browser but in IE-11 version blank screen is shown with the following error in console as mentioned in this link: https://drive.google.com/file/d/1QaNwK1ekI2BwFsFyjvgbSsvwHBCmlcAD/view?usp=drivesdk On clicking console error that I have pointed in above screenshot, it opens a screen as display in given link https://drive.google.com/file/d/1_QXVjcw3cmqeC70LfNyLcr__rnXVIZIh/view?usp=drivesdk with the error in mini-toastr package: Here is my babel.config.js file code:
module.exports = {
presets: [
['@vue/app', {
polyfills: [
'es6.promise',
'es6.symbol'
]
}]
]
}
和 .browserslistrc 文件代码:
and .browserslistrc file code :
> 1%
last 2 versions
not ie <= 8
我不知道我做错了什么.我缺少什么吗?如果有人需要更多信息,请告诉我.谢谢!
I am not getting where I am doing a mistake. Is anything I am missing? If anyone need some more info please let me know. Thanks!
推荐答案
我终于得到了上述问题的解决方案.要在 IE-11 版本上运行项目,只需执行以下 2 个步骤:
I finally ended up with the solution of above issue. To run project on IE-11 version just follow the 2 steps:
- 使用命令npm install --save babel-polyfill"安装 babel-polyfill.
- 在您的 main.js 或 index.js 文件中导入 babel-polyfill,位于所有导入包的顶部.例如,这是您的 main.js 文件.
注意:如果最后导入 babel-polyfill 则不起作用.
Note: If you import babel-polyfill at the end it does't work.
import 'babel-polyfill'
import Vue from 'vue'
import Vuetify from 'vuetify'
import router from './router'
// include script file
import './lib/DemoScript'
// include all css files
import './lib/DemoCss'
Vue.use(Vuetify)
new Vue({
store,
router,
render: h => h(App),
components: { App }
}).$mount('#app')
这篇关于VUE CLI-3 项目不适用于 IE-11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!