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}