The use of local components of vue global components

First of all, make sure to register the component before initializing the root instance. Generally speaking, register the component first, and then create the vue instance. The instance should be created after the component is registered.

Registering global components with Vue.component

Create a vue instance

How can a component be used as a custom element in an instance template after it is registered

Register partial components with components

First declare a component template string

Create a vue instance

used in parent component

Here you will get the result

The global component <my></my> can be used normally in app1

The partial component <my-child></my-child> can only be used in app1

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324583078&siteId=291194637