export default{ //开启命名空间 namespaced:true, //数据 state:()=>({ // address:JSON.parse(uni.getStorageSync('address')||'{addresses:[]}').addresses, address:[] }), //方法 mutations:{ //更新收货地址 addAddress(state,address){ state.address.push(address) }, //持久化储存address saveAddressToStorage(state){ uni.setStorageSync('address',JSON.stringify({addresses:state.address})) } }, getters:{ //收货地址 addstr(state){ if(!state.address.provinceName) return '' return state.address.provinceName+state.address.cityName+state.address.countyName+state.address.detailInfo }, getAddressList(state){ let ret=[] console.log(state.address,"空吗") for (let i=0;i