wangzhibo
4 天以前 10595d8632f959d0954d1939243196f4eed02372
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { defineStore } from "pinia";
import { ref } from "vue";
import { service } from "/@/cool";
 
export const useAddress = defineStore("address", () => {
    const info = ref<Eps.UserAddressEntity>();
 
    function set(data: Eps.UserAddressEntity) {
        info.value = data;
    }
 
    function getDefault() {
        if (!info.value || info.value?.isDefault) {
            service.user.address.default().then((res) => {
                info.value = res;
            });
        }
    }
 
    return {
        info,
        set,
        getDefault,
    };
});
 
export * from "./shopping-cart";
export * from "./spec";
export * from "./order";