DEV Community

Zachary Powell
Zachary Powell

Posted on

What Can I Do If the onShow Lifecycle Function Is Not Triggered?

Symptom

When a user is redirected to a quick app page that references only a single custom element through the router.push API, the onShow lifecycle function for that page cannot be triggered, as shown in the following figure.

The code where the exception occurs is as follows:

Code of the custom element (aa.ux):

Cause Analysis

Huawei Quick App Loader does not trigger the onShow lifecycle function if the root node of the page is a custom element. However, the function can be triggered for a subelement.

Solution

Add the div element, instead of a custom element, as the root node.

The modified code is as follows:

Top comments (0)