代码合并
This commit is contained in:
@@ -226,9 +226,27 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
const isLinkFinshed = ref(false);
|
||||
|
||||
// 当前购物车数据(现在 getAllGoodsList 能直接访问)
|
||||
const list = useStorage<any[]>("carts", []);
|
||||
// 历史订单数据(现在 getAllGoodsList 能直接访问),不从本地缓存获取,改为从接口获取
|
||||
const oldOrder = ref<any>({
|
||||
const list = useStorage<any[]>(
|
||||
"carts",
|
||||
[],
|
||||
localStorage,
|
||||
{
|
||||
serializer: {
|
||||
read: (rawValue) => {
|
||||
// 没有值时直接返回默认空数组
|
||||
if (!rawValue) return []
|
||||
try {
|
||||
return JSON.parse(rawValue)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
},
|
||||
write: (value) => JSON.stringify(value),
|
||||
},
|
||||
}
|
||||
)
|
||||
// 历史订单数据(现在 getAllGoodsList 能直接访问)
|
||||
const oldOrder = useStorage<any>("Instead_olold_order", {
|
||||
detailMap: [],
|
||||
originAmount: 0
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user