More typescript

This commit is contained in:
2024-11-28 18:36:57 +01:00
parent faa17e87c9
commit afb9f106f9
4 changed files with 36 additions and 39 deletions

View File

@@ -1,22 +1,10 @@
<script setup>
const props = defineProps({
championId: {
type: String,
required: true
},
winrate: {
type: Number,
required: true
},
pickrate: {
type: Number,
required: true
},
gameCount: {
type: Number,
required: true
}
})
<script setup lang="ts">
const props = defineProps<{
championId: string,
winrate: number,
pickrate: number,
gameCount: number
}>()
const championId = Number(props.championId)
@@ -24,10 +12,9 @@ const winrate = (props.winrate * 100).toFixed(2)
const pickrate = (props.pickrate * 100).toFixed(2)
const gameCount = props.gameCount
const { data: championData } = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/champions/" + championId + ".json")
const { data: championData } : ChampionResponse = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/champions/" + championId + ".json")
const championName = championData.value.name
const championDescription = championData.value.title
</script>
<template>