In the vue project, how do you add an item to an array using the $set () method?

for example: obj = {name: "wh"}, add obj to arr = [1,2,3], and the implementation result is arr = [{name:" wh"}, 1,2,3]


just use the push method of the array directly.
of course, if you must use $set, just set the length of the array as the key


arr.ubshift (obj)


first of all, do you understand when the set is used? Secondly, the people who answered did not care why the landlord used $set. Just change the array directly, if the array you modified is not bidirectionally bound to the view layer, and your requirements need to be updated by the view layer, what's the use of using ubshift and changing the array directly?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf03ee-46271.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf03ee-46271.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?