feat(wip): gameConstStore inject
This commit is contained in:
@@ -1,12 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<BContainer id="container" :toast="{ root: true }" class="pageNationGeneral bg0">
|
<BContainer id="container" :toast="{ root: true }" class="pageNationGeneral bg0">
|
||||||
<TopBackBar :title="title" />
|
<TopBackBar :title="title" />
|
||||||
<Suspense>
|
<GeneralList v-if="asyncReady" :list="generalList" :height="'fill'" />
|
||||||
<GeneralList :list="generalList" :height="'fill'" />
|
|
||||||
<template #fallback>
|
|
||||||
불러오는 중입니다...
|
|
||||||
</template>
|
|
||||||
</Suspense>
|
|
||||||
<BottomBar />
|
<BottomBar />
|
||||||
</BContainer>
|
</BContainer>
|
||||||
</template>
|
</template>
|
||||||
@@ -22,16 +17,30 @@
|
|||||||
import TopBackBar from "@/components/TopBackBar.vue";
|
import TopBackBar from "@/components/TopBackBar.vue";
|
||||||
import BottomBar from "@/components/BottomBar.vue";
|
import BottomBar from "@/components/BottomBar.vue";
|
||||||
import { BContainer } from "bootstrap-vue-3";
|
import { BContainer } from "bootstrap-vue-3";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, provide, ref } from "vue";
|
||||||
import { SammoAPI } from "./SammoAPI";
|
import { SammoAPI } from "./SammoAPI";
|
||||||
import { merge2DArrToObjectArr } from "./util/merge2DArrToObjectArr";
|
import { merge2DArrToObjectArr } from "./util/merge2DArrToObjectArr";
|
||||||
import type { GeneralListItem } from "./defs/API/Nation";
|
import type { GeneralListItem } from "./defs/API/Nation";
|
||||||
import GeneralList from "./components/GeneralList.vue";
|
import GeneralList from "./components/GeneralList.vue";
|
||||||
|
import { type GameConstStore, getGameConstStore } from "./GameConstStore";
|
||||||
|
|
||||||
const generalList = ref<GeneralListItem[]>([]);
|
const generalList = ref<GeneralListItem[]>([]);
|
||||||
|
|
||||||
|
const gameConstStore = ref<GameConstStore>();
|
||||||
|
provide('gameConstStore', gameConstStore);
|
||||||
|
|
||||||
|
const asyncReady = ref(false);
|
||||||
|
|
||||||
const title = "세력 장수";
|
const title = "세력 장수";
|
||||||
|
|
||||||
|
const storeP = getGameConstStore().then((store)=>{
|
||||||
|
gameConstStore.value = store;
|
||||||
|
});
|
||||||
|
|
||||||
|
void Promise.all([storeP]).then(()=>{
|
||||||
|
asyncReady.value = true;
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const { column, list, permission } = await SammoAPI.Nation.GeneralList();
|
const { column, list, permission } = await SammoAPI.Nation.GeneralList();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { GeneralListItem, GeneralListItemP2 } from "@/defs/API/Nation";
|
import type { GeneralListItem, GeneralListItemP2 } from "@/defs/API/Nation";
|
||||||
import { getIconPath } from "@/util/getIconPath";
|
import { getIconPath } from "@/util/getIconPath";
|
||||||
import { ref, watch, type PropType, type StyleValue } from "vue";
|
import { inject, ref, watch, type PropType, type Ref, type StyleValue } from "vue";
|
||||||
import { AgGridVue } from "ag-grid-vue3";
|
import { AgGridVue } from "ag-grid-vue3";
|
||||||
import type {
|
import type {
|
||||||
CellClassParams,
|
CellClassParams,
|
||||||
@@ -38,6 +38,8 @@ import type {
|
|||||||
BaseWithValueColDefParams,
|
BaseWithValueColDefParams,
|
||||||
ValueGetterParams,
|
ValueGetterParams,
|
||||||
} from "ag-grid-community/dist/lib/entities/colDef";
|
} from "ag-grid-community/dist/lib/entities/colDef";
|
||||||
|
import type { GameConstStore } from "@/GameConstStore";
|
||||||
|
import { unwrap } from "@/util/unwrap";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: {
|
list: {
|
||||||
@@ -52,6 +54,9 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const gameConstStore = unwrap(inject<Ref<GameConstStore>>('gameConstStore'));
|
||||||
|
const iActionInfo = gameConstStore.value.iActionInfo;
|
||||||
|
console.log(iActionInfo);
|
||||||
//debug
|
//debug
|
||||||
console.log(`list`, props.list);
|
console.log(`list`, props.list);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user