Ale.js

# Composite component

### Start

Ale allows you to bind any component with the imports property, and the new component will become a composite component:

Once complete, the test component becomes a composite component.

So now if we render the test component, it will only output World instead of the HelloWorld we need. At this point we can add the test-1 component using the custom tag in the template properties of the test component:

Among them, we use the <test-1/> format to render the test-1 component, then it should be noted that the custom label can only be used for this format, even a space can not be added!

Now let’s render this component:

Already working, right? In fact, you can not only include a single component, but also include a composite component:

Composite components are compared to normal (single) components:

• The entire composite component shares a data. That is, there is no hierarchical relationship between composite components, and any component can manipulate data from all other components. (In addition, according to the order in which imports are imported, data of the same name will overwrite the previous data of the same name)

• The entire composite component shares a single method.

• The entire composite component shares a proxy.

• The entire composite component shares a life.

#### Including local components

If you want to include a partial component, simply reference the Ale local component generation object in the imports property.

At the same time you need to add a name attribute to the local component, otherwise Ale has no way to distinguish the name of the local component [default is unknown]:

Found some errors? Edit on Github!