简体   繁体   中英

What would be the way to replace a observable array in Vue.js?

Instead of just assigning newGroups. How would it be done with Vue.$set to keep the observable array ?

   this.groups = newGroups;

Use splice . This works nicely with the spread syntax

this.groups.splice(0, this.groups.length, ...newGroups);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM