Vue: About multi-routed public templates that cause intra-component array caching issues

Source: Internet
Author: User

When multiple routes are multiplexed with the same template, the template is not re-mounted when switching between these routes. For this situation, we need to listen to the route in the current logic, update the corresponding property when the change occurs, and satisfy the requirement.

However, in the implementation process you will encounter the following situations:

 

Shows that the prop attribute that was transferred to El-table when the page was switched has changed, but the inner loop binding has not changed because Vue does not listen to deep-seated object properties or array values.

The solution is to use the V-IF directive to bind the state over when the routing is switched. This assumes that the v-if= "view = = = ' Main '" represents the display, in the process of switching the view is set to ' loading ', and then the delay update to ' main ', so that the list exhibition experience "show = = disappear and show" process, the list component will go through the "mount = > Destroy the "= mount" process so that the component releases the cached data to force the update, which conforms to the design of the flexible configuration properties of our previous multi-page reusable templates.

Here is a record of my previous thinking about the solution, I hope to help you. This question examines more of our understanding of the two-way binding mechanism of component lifecycles and attributes. If you have more ideas and discussions, please leave a message for me. Thank you

Vue: About multi-routed public templates that cause intra-component array caching issues

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.