JavaScript Framework fairy support js
Unique component

How to use

Single component loaded component using loadSingleComponent method
If you want to use a unique component, use the loadUniqueComponent method. The arguments are the same for both loadSingleComponent and loadUniqueComponent.
If appendLoadUniqueComponent is used instead of loadUniqueComponent, the body part will be added to the body part instead of replacing it.
If you set beforeLoadUniqueComponent instead of loadUniqueComponent, the body part will be added just before the first argument instead of replacing.
If afterLoadUniqueComponent is used instead of loadUniqueComponent, the body part will be added immediately after the first argument instead of replacing it.
event handling, binding DOM to component field, initial processing, all usage is the same as a single component.

Call a unique component from the template or view.html of component

Example

<script data-load-only='true'>
        l.nestVal = {'key1': 'val1'};
</script>
<div data-unique-component='sample2' data-unique-component-variable='l.nestVal'></div>

The data-unique-component attribute value is the same as the second argument of loadUniqueComponent.
The data-unique-component-variable attribute value is the same as the third argument of loadUniqueComponent.
A unique component is loaded inside a tag with the data-unique-component, data-unique-component-variable attributes.


Next page Difference between single component and unique component

table of contents