undefinedfix
Sign in

In Internet Explorer, only one route can't jump normally

FREDANDFARID edited in Fri, 02 Sep 2022

The Vue project encountered a very strange problem and was very troubled. In Internet Explorer browser (ie11 and below), only one route could not jump normally, and the others were normal. The routing code is as follows:

  {
    path: '/school',
    name: 'school',
    component: reslove => require(['@/views/school/'], reslove)
  },
  {
    path: '/personal',
    name: 'personal',
    component: reslove => require(['@/views/personal/'], reslove)
  },

The problem is this personal. The error message is as follows: failed to resolve async component default: syntax error: multiple definitions of an attribute are not allowed in strict mode

If you click the page for the second time in a row, you will leave the current page, but you can't get the page content corresponding to personal. If you open a new tab, the access route will be completely blank. It's not good to try to change personal to another name. It's strange that you can jump by changing the template file to another name, such as school, but not all other templates that 's ok.. I don't know if it has anything to do with ES6 compilation

4 Replies
jet_black82
commented on Fri, 02 Sep 2022

图片描述

Because ie11 and below do not support symbol in ES6, the browser thinks that you have declared the same attribute many times, and repeated declaration is not allowed in JS strict mode

fordev
commented on Sat, 03 Sep 2022

In ie, ES6 should be transferred to Es5. The following conversion method: you need to install Babel Polyfill

npm install --save babel-polyfill
And then in the main.js Introduce the plug-in

clipboard.png

Finally, you need to configure the entry in the webpack. App: ['babel-polyfill ','. / SRC/ main.js ']

clipboard.png

Finally, restart the project

npm run dev
NoGuru
commented on Sat, 03 Sep 2022

You should post the template code under view / personal /

Guess that the same variable is defined many times

jlavallet
commented on Sat, 03 Sep 2022

See if there is a problem in this file @ / views / personal/

lock This question has been locked and the reply function has been disabled.