Vue.js life cycle hook functions and caches

Source: Internet
Author: User

When using vue.js for development, the most used is created, mounted, activated.

Because there are cases where we need to reuse some components, we need to use keep-alive.

  When the introduction of Keep-alive, the first time the page entered, the trigger order of the hook is created-> mounted-> activated. When you enter the page again, only the activated is triggered.

Therefore, you should leave a copy of the data obtained in the activated code, or do not created part of the code to directly transfer created in activated.

Created: the instance is called after it has been created, and the method that triggers the function is triggered when the page is just entered. Executes only once when the page has just started loading.

Mounted: The method is executed when the page is loaded.

Called when the activated:keep-alive component is activated. This is called when the page has a cache.

Vue.js life cycle hook functions and caches

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.