dcc
2024-07-02 431506e6b44e636f1e1df9ad6cde133b26b9800d
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
import { defineStore } from "pinia";
 
export const useCountryCodeStore = defineStore("countryCode", {
  // state 持久化
  persist: true,
  state: () => {
    return {
      code: "1",
      iso2: "us",
    };
  },
  getters: {},
  actions: {
    async updateCountry(val) {
      this.code = val;
    },
    async updateIso2(val) {
      this.iso2 = val;
    },
    async resetCountry() {
      this.code = "1";
      this.iso2 = "us";
    },
  },
});