Lane-dependant stats (fix #5)
This commit is contained in:
@@ -8,15 +8,12 @@ const emit = defineEmits<{
|
||||
refresh: []
|
||||
}>()
|
||||
|
||||
const item = props.tree
|
||||
|
||||
const {data : items} : ItemResponse = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/items.json")
|
||||
const itemMap = reactive(new Map())
|
||||
for(let item of items.value) {
|
||||
itemMap.set(item.id, item)
|
||||
}
|
||||
|
||||
import type { TreeItem } from '#build/components';
|
||||
import pkg from 'svg-dom-arrows';
|
||||
const { LinePath } = pkg;
|
||||
|
||||
@@ -28,6 +25,18 @@ onMounted(() => {
|
||||
emit('mount', start.value!!)
|
||||
})
|
||||
|
||||
onBeforeUpdate(() => {
|
||||
for(let arrow of arrows) {
|
||||
arrow.release()
|
||||
}
|
||||
arrows.splice(0, arrows.length)
|
||||
})
|
||||
|
||||
onUpdated(() => {
|
||||
refreshArrows()
|
||||
emit('mount', start.value!!)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
for(let arrow of arrows) {
|
||||
arrow.release()
|
||||
@@ -84,13 +93,13 @@ function handleRefresh() {
|
||||
<template>
|
||||
<div style="display: flex; align-items: center;">
|
||||
|
||||
<div v-if="item.data != undefined && item.data != null" style="width: fit-content; height: fit-content;">
|
||||
<img ref="start" class="item-img" width="64" height="64" :alt="item.data.toString()" :src="CDRAGON_BASE + mapPath(itemMap.get(item.data).iconPath)" />
|
||||
<h3 style="width: fit-content; margin:auto; margin-bottom: 10px;">{{ item.count }}</h3>
|
||||
<div v-if="tree.data != undefined && tree.data != null" style="width: fit-content; height: fit-content;">
|
||||
<img ref="start" class="item-img" width="64" height="64" :alt="tree.data.toString()" :src="CDRAGON_BASE + mapPath(itemMap.get(tree.data).iconPath)" />
|
||||
<h3 style="width: fit-content; margin:auto; margin-bottom: 10px;">{{ tree.count }}</h3>
|
||||
</div>
|
||||
|
||||
<div style="margin-left: 30px;">
|
||||
<div style="width: fit-content; height: fit-content;" v-for="child in item.children">
|
||||
<div style="width: fit-content; height: fit-content;" v-for="child in tree.children">
|
||||
<TreeItem @refresh="handleRefresh" @mount="(end) => handleSubtreeMount(end)" :tree="child" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user