html购物车中选择打对勾,怎么把购物车里勾选的商品放进下单页面?

使用vuex怎么购物车里勾选了的商品放进下单页面

购物车的code

删除

总计:¥{{sum}}

继续购物

//下单页面按钮

下单

toggleSelect(id){

var i=this.findPosition(id);

var select=this.goodsList[i].select;

this.updatedGoods({

index:i,

key:"select",

value:!select //这里切换false和true

})

}

vuex code

import Vue from 'vue'

import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({

state:{

goodsList:localStorage["goodsList"]?JSON.parse(localStorage["goodsList"]):[]

},

getters:{

sum:state=>{

var total=0;

state.goodsList.forEach((item)=>{

if(item.select){

total=(Number(total)+Number(item.price*item.number)+Number(item.freight)).toFixed(2)

}

})

return total

},

gooddsNumber:state=>{

return state.goodsList.length

}

},

mutations:{

getData(state,val){

state.goodsList.push(val);

localStorage.setItem("goodsList",JSON.stringify(state.goodsList))

},

deleteGoods(state,index){

state.goodsList.splice(index,1);

localStorage.setItem("goodsList",JSON.stringify(state.goodsList))

},

updatedGoods(state,data){

const {index,key,value}=data;

if(state.goodsList[index].inventory>=value){

state.goodsList[index][key]=value;

}else{

alert("库存不足")

}

localStorage.setItem("goodsList",JSON.stringify(state.goodsList))

}

},

actions:{

},

})

这个是之前放在getter中 把它存进本地存储

显示为空

bV6sFz?w=1044&h=24

bV6sFE?w=229&h=591