Disable the caching function that comes with Vue computing properties.

Source: Internet
Author: User

Disable the caching function that comes with Vue computing properties.

All Vue users will know the computing attributes of vue. This is explained in the following way. When some dependent values change, their own values also change, and the First DOM also changes. Normally, there are two methods in this calculation attribute: get and set.

Here I will only analyze how to disable the computing attribute cache to obtain the latest data, as shown in the following example:

HTML code

<Div id = "mess"> <div >{{ exapm }}</div> </div>

JS Code:

Var vue2 = new Vue ({el: "# mess", data: {sendmess: "I dhsjknkjvnkrenvr"}, computed: {exapm: {cache: false, get: function () {return Date. now () + this. sendmess }}}});

We need to set the cache to false so that the cache is cleared. Each time we set the cache time to the current time.

The cache function that comes with the Vue computing attribute is all the content that I have shared with you in this article. I hope you can give us a reference and support for more customers.

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.