The steps on the website are:
Problem 1 cannot implement automatic import on demand:
In normal cases, babel-plugin-import will be automatically generated in the root directory of the project after the installation of babel-plugin-import. However, the babelrc file was not generated in the root directory after the installation of the plug-in, and the terminal did not report an error.
Later, I created a new.babelrc file in the root directory, and continued to follow the steps. The result was an error, and the terminal prompted me to install the CSS file corresponding to the component, which was obviously not the solution, and it was a deviation from the original intention of automatic on-demand introduction.
Solution: I still thought there was some unknown problem with the plugin installation, so I deleted the node_modules file and the.babelrc file that I created myself, executed NPM I, didn’t create the.babelrc file this time, just configured babel.config.js, Then import {Button} from ‘vant’ in main.js and implement it successfully with vue.use (Button)
Problem 2 Failed to import multiple components:
When you introduce more than one component, it is written this way
Result error:
Obviously, the component was not registered successfully
Solution: While searching for the cause of problem 1, I came across an article that said either of the following methods can be used
Brainwave change method two, successful solution
-_- Weird questions…