Ale.js

Method

1.0.0Updated content:

In version 1.0.0 and later, use this in any function in the methods parameter to refer to the ale component object after rendering.

Also, in version 1.0.0 and later, you can also dynamically set or override the methods property when the component is rendered.

Start

Let’s follow the tutorial for the component life, or an example of a timer:

</p

I don’t know if you noticed that our timer is added directly to this:

However, if we are not careful, the added function has the same name as the built-in function in Ale Component Object, then there will be some unknown bugs.

At this point, we recommend that you add the function to the built-in property methods in the Ale component object!

Let’s modify the code:

The instance is executable normally.

At the same time, you can also set methods when the component is defined:

Like the data property, the methods property is automatically bound to all elements and child elements of the component, accessible via this.methods: