Champions are sorted :)
This commit is contained in:
@@ -1,12 +1,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const {data: champions} = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/champion-summary.json")
|
const {data: champions} = await useFetch(CDRAGON_BASE + "plugins/rcp-be-lol-game-data/global/default/v1/champion-summary.json")
|
||||||
const filteredChampions = ref(champions.value.slice(1))
|
champions.value = champions.value.slice(1).sort((a, b) => {
|
||||||
|
if(a.name < b.name) return -1;
|
||||||
|
if(a.name > b.name) return 1;
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
|
const filteredChampions = ref(champions.value)
|
||||||
|
|
||||||
const searchBar = ref(null)
|
const searchBar = ref(null)
|
||||||
watch(searchBar, (newS, oldS) => {searchBar.value.focus()})
|
watch(searchBar, (newS, oldS) => {searchBar.value.focus()})
|
||||||
const searchText = ref("")
|
const searchText = ref("")
|
||||||
watch(searchText, (newT, oldT) => {
|
watch(searchText, (newT, oldT) => {
|
||||||
filteredChampions.value = champions.value.slice(1).filter((champion) => champion.name.toLowerCase().includes(searchText.value.toLowerCase()))
|
filteredChampions.value = champions.value.filter((champion) => champion.name.toLowerCase().includes(searchText.value.toLowerCase()))
|
||||||
})
|
})
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user