After vue introduces elementUi, open the page and report an error
After I created a vue project with idea and introduced elemenUi, the webpage reported an error:
Uncaught TypeError: Cannot read properties of undefined(reading 'prototype').
Baidu has found many ways to say that it is because elementUi was introduced in vue3. After vue3.0, elementUi is not supported. I need to use element plus, but because I want to use Zoyi to be lazy, I have to use elementUi. Many articles say that it is vue - V command to check the vue version. After I typed the command, it was indeed a version after 3, so I uninstalled and reinstalled version 2.9.6.
However, after downgrading the version, this problem still occurs. After asking the front-end friends, I found that the current csdn is really mixed, with a lot of wrong information. The vue-V command is not the vue version, but the scaffolding version, which has nothing to do with the vue version.
There is another way, Just find the package.json file of your vue project. In the devDependencies, you can see the vue version used by your project. You
can see that even if I drop to 2.9.6, the vue version is still after 3.0, because 2.9.6 is a scaffolding version . After that, I re-downloaded the scaffolding, and then used the command line to create a vue project. Remember not to use idea to directly new. Direct new seems to create vue3 by default, or my method may be incorrect. If you use the command line to create, the first option is to choose the vue version. Here, you can choose vue2.
After the command line is created, open package.json to
see that it is now the vue2 version. Introduce elementUi, and the page can be Open normally, problem solved