Some very basic components may be used in many places, but if they are written as separate components, they need to be introduced and registered as local components where they are used.
It is very troublesome to write in this way, and it is also troublesome to maintain it.
For some basic components, such as image encapsulation, you can register them as global components.
The registration method is as follows:
import Vue from"vue"; import someComponent from "@/components/someComponent"; Vue.component("someComponent", someComponent);
After that globalComponent.js File import to main.js You can:
You can then use the somecomponent component component anywhere in the project.