Vue learning day six

1. It is recommended to use uppercase letters when naming imported components to distinguish them from ordinary components.

2. If the data on which the calculated attribute depends changes, the calculated attribute will recalculate the value.

3. Sequence: Instructions first, attributes and events bound last.

4. Dynamic components: Dynamically control the hiding and display of components. Represented by <component>.

Component is a built-in component of Vue. It functions as a label placeholder. The is attribute of the label is to display the name of the component, and the name is registered under the components node.

<component is="Left"></component>

 5. Use of dynamic component-keep-alive

Switching the is attribute will cause the destruction of the old component displayed and the creation of a new component. keep-alive can prevent components from being destroyed, just inactivated.

<keep-alive>

       <component is="Left"></component>

</keep-alive>

Using keep-alive will trigger the life cycle functions actived (component is activated) and deactived (component is cached). When a component is created for the first time, the create function is triggered first, and then the actived function is triggered. When the component is deactivated using a dynamic component component, the component will activate the deactived function without triggering the destroyed destruction function.

6. keep-alive’s include and exclude attributes

Components used by include to match names will be cached. Multiple components are separated by commas.

Components used by exlude for name matching will not be cached. Multiple components are separated by commas.

(Note: Either of the two cannot be used at the same time)

Finally, learn the shopping cart case today and make up for it over the weekend.

Guess you like

Origin blog.csdn.net/DW_css/article/details/120357168