Refonte inventaire et objets #236
3 changed files with 19 additions and 5 deletions
|
@ -14,6 +14,10 @@ const props = defineProps({
|
||||||
type: Array as PropType<string[]>,
|
type: Array as PropType<string[]>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
category: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const DEFAULT_MAX_ITEM_BY_PAGE = 10;
|
const DEFAULT_MAX_ITEM_BY_PAGE = 10;
|
||||||
|
@ -33,15 +37,21 @@ const paginatedList = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
refresh();
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
table.fields = props.fields;
|
table.fields = props.fields;
|
||||||
for (const file of props.files) {
|
for (const file of props.files) {
|
||||||
const listItems = `/jdr/objets/${file}.json`;
|
const listItems = `/jdr/${props.category}/${file}.json`;
|
||||||
axios.get(listItems).then((response) => {
|
axios.get(listItems).then((response) => {
|
||||||
table.addItems(response.data);
|
table.addItems(response.data);
|
||||||
table.currentPage = 0;
|
table.currentPage = 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
function switchFilter(filterSet: string | number, filterName: string | number) {
|
function switchFilter(filterSet: string | number, filterName: string | number) {
|
||||||
table.switchFilter(filterSet as string, filterName as string);
|
table.switchFilter(filterSet as string, filterName as string);
|
||||||
|
|
|
@ -6,4 +6,5 @@ export default interface JdrConfig {
|
||||||
sidebar: LinkList[];
|
sidebar: LinkList[];
|
||||||
hideLinks: HideLink[];
|
hideLinks: HideLink[];
|
||||||
vars: { name: string; value: string }[];
|
vars: { name: string; value: string }[];
|
||||||
|
objects: string[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,27 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import DynTable from "@/components/tableaux/DynTable.vue";
|
import DynTable from "@/components/tableaux/DynTable.vue";
|
||||||
import { useConfigStore } from "@/stores/config";
|
import { useConfigStore } from "@/stores/config";
|
||||||
import { onMounted } from "vue";
|
import { onMounted, computed } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import MarkdownFile from "../components/MarkdownFile.vue";
|
import MarkdownFile from "../components/MarkdownFile.vue";
|
||||||
import { objectFields } from "@/data/fields";
|
import { objectFields } from "@/data/fields";
|
||||||
|
|
||||||
const store = useConfigStore();
|
const store = useConfigStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const objectTest = ["base", "potions"];
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
store.loadJdr(`${route.params.jdr}`);
|
store.loadJdr(`${route.params.jdr}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const objects = computed(() => {
|
||||||
|
return store.jdrConfig?.objects ?? [];
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main>
|
<main>
|
||||||
<MarkdownFile :path="`rules/inventaire/objets`">
|
<MarkdownFile :path="`rules/inventaire/objets`">
|
||||||
<DynTable :fields="objectFields" :files="objectTest" />
|
<DynTable :fields="objectFields" :files="objects" category="objets" />
|
||||||
</MarkdownFile>
|
</MarkdownFile>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in a new issue