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