More typescript
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
type ChampionResponse = {
|
||||
data: Ref<Array<Champion>>
|
||||
}
|
||||
type Champion = {
|
||||
name: string
|
||||
alias: string
|
||||
squarePortraitPath: string
|
||||
}
|
||||
const {data: championsData} : ChampionResponse = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/champion-summary.json")
|
||||
const {data: championsData} : ChampionsResponse = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/champion-summary.json")
|
||||
const champions = championsData.value.slice(1).sort((a, b) => {
|
||||
if(a.name < b.name) return -1;
|
||||
if(a.name > b.name) return 1;
|
||||
@@ -46,9 +38,6 @@ function filterToLane(filter: number) {
|
||||
|
||||
function onLaneFilterChange(newValue: number) {
|
||||
if(newValue != -1) {
|
||||
|
||||
|
||||
|
||||
filteredChampions.value = champions.filter((champion) => {
|
||||
const lanes : Array<any> = lanesMap.get(champion.alias.toLowerCase())
|
||||
if(lanes == undefined) return false;
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user