The problem of vue.js threading mechanism or the delay of data bidirectional binding

Source: Internet
Author: User

Recently used Select2 to do a next Lado, if just get a list from the back-end rendering Fortunately, there is no problem. However, there is a problem with Select2 to display the default options for selected when the data is initialized.

  

VMs. $set (' areas ', data.data); areaIdsSelect2 (); Areaidsselect2change ();

The zone does not show the default selected. Now make a timer,

  

VM. $set (' areas ', Data.data); SetTimeout (function  () {      areaIdsSelect2 ();      Areaidsselect2change ();},1);

  

A 1-millisecond delay will work properly. The problem was analyzed for a long time and no answer was found. Now feel the need for threading mechanism and data binding in depth, this aspect needs to study Vuejs source code, now do not have the conditions to do this work, this problem is first written down, later study.

The problem of vue.js threading mechanism or the delay of data bidirectional binding

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.