stores/index.ts
stores/counter.ts
stores/user.ts
stores/loader.ts
....
가 있다고 가정하자
이때, index.ts에서 나머지들을 관리할 수 있다.
import { useUserStore } from "@/stores/user";
import { useLoaderStore } from "@/stores/loader";
import { useSnbStore } from "@/stores/counter";
....
export const stores = {
useUserStore,
useSnbStore,
useLoaderStore....
};
이것이 Vue에서 참조되는 것은 이렇게 쓰인다.
import { stores } from "@/stores";
const snbStore = stores.useSnbStore();