LocalStorage storage data problem

the code is as follows:

    [SAVE_COLLECT](state,collectId){
        let collectArr = state.collectList.push(collectId);
        console.log(collectArr)
        //localStorage
        setStore("collectList",collectArr);
        console.log(window.localStorage)
    },

the value collectId passed in is the product id,. The purpose is to store the product id in localStorage,
every time you click on the product
question: when console.log (collectArr) clicks on the first product, it outputs 1 instead of an array containing the product id

.
Storage{collectList: "1", loglevel:webpack-dev-server: "WARN", prolist: "{"productId":22643,"title":"","cover":"httrice":0,"currentPrice":873,"channel":"","tab":""}", userInfo: "{"phone":"123456","code":"1234"}", length: 4}
Feb.25,2022

this has nothing to do with localstorage .
let collectArr = state.collectList.push (collectId); / / push the operation returns length of the array, so the value at this time is 1
should be changed to

.
state.collectList.push(collectId);
let collectArr = state.collectList;
localstorage.setItem('collectList',JSON.stringify(collectArr));
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-1e3dda4-597b8.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-1e3dda4-597b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?