Home > Web Front-end > JS Tutorial > body text

How to solve the problem of blank project page when opening Vue 2.0 in IE11

不言
Release: 2018-06-29 16:53:40
Original
3284 people have browsed it

This article mainly introduces to you the solution to the problem of blank project page opening in IE 11 in Vue 2.0. The article analyzes the reasons for this problem in detail and gives detailed solutions. Friends in need can refer to it. Let’s learn from it and learn it together.

Preface

Due to work needs, I have been learning Vue2.0 for a while. Recently, I am using the official scaffolding tool of Vue2.0 to build it. The project has been running without problems in chrome, but a bug appeared when opening it in ie11:

Problem

ie11 opened the vue2.0 project Blank, console error vuex requires a Promise polyfill in this browser;

Reason

Babel only converts new ones by default JavaScript syntax (syntax) without converting new APIs, such as Iterator, Generator, Set, Maps, Proxy, Reflect, Symbol, Promise and other global objects, as well as some methods defined on global objects (such as Object.assign) Will not transcode. To solve this problem, we use a technology called Polyfill (code filling, also translated as compatibility patch).

Simply put, polyfill is the code used to copy (meaning simulated copying, not copying) the native api that does not yet exist in the current running environment.

Solution

Installationbabel-polyfill

Steps

npm installation

npm install --save-dev babel-polyfill
Copy after login

Pour it into the entry file

import 'babel-polyfill'
Copy after login

If you also use the official scaffolding vue-cli, you also need to make various modifications in the webpack.config.js configuration file, use

module.exports = {
 entry: {
 app: ["babel-polyfill", "./src/main.js"]
 }
};
Copy after login

Replace

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

The above is the entire content of this article. I hope it will be helpful to everyone’s study. Please pay attention to more related content. PHP Chinese website!

Related recommendations:

How to solve the problem of incorrect access path after packaging the Vue background image

How to solve the vue project Issue with blank page when opening after packaging

The above is the detailed content of How to solve the problem of blank project page when opening Vue 2.0 in IE11. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!