As we know from the previous article, the life cycle of the wechat applets component does not perform as expected. Recently we found a new problem about the life cycle of wechat applets.

The component Attached life cycle is not executed

This is how the official documentation describes the Attached life cycle.

The Attached life cycle is triggered after the component is fully initialized and the page node tree is entered. At this point, this.data has been initialized to the current value of the component. This lifecycle is useful, and most of the initialization work can be done at this point.

Thus, the Attached life cycle is suitable for the initialization of components. But what if the component skips this life cycle?

Scenario reduction

Assume a page page1, a parent component child1, and a child component child2. There are three scenarios where the child component child2 does not execute the Attached life cycle and only executes the Created and Ready life cycle. You can view the complete code snippet.