This commit is contained in:
2025-03-12 09:36:26 +08:00
parent b98464d8b5
commit 6053fba1da
22 changed files with 286 additions and 228 deletions
+4
View File
@@ -0,0 +1,4 @@
import {defineStore} from 'pinia'
const config = defineStore('config', ()=>{
})
-12
View File
@@ -1,12 +0,0 @@
import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
return { count, doubleCount, increment }
})
+5
View File
@@ -0,0 +1,5 @@
import { createPinia } from "pinia"
export * from "./info"
export const pinia = createPinia()
+29
View File
@@ -0,0 +1,29 @@
import api from "@/api"
import type { ICharacterInfo } from "@/api/info/type"
import { defineStore } from "pinia"
export const useInfoStore = defineStore("infoStore", ()=>{
const token = ref<string>("")
const infos = ref<ICharacterInfo | null>(null)
const skills = computed(()=>infos.value?.skills ?? [])
const equips = computed(()=>infos.value?.equips ?? [])
const suits = computed(()=>infos.value?.suits ?? [])
const createCharacter = async (alter: string, equVersion?: string) => {
token.value = await api.createToken(alter, equVersion)
infos.value = await api.characterInfo()
}
return {
token,
infos,
skills,
equips,
suits,
createCharacter,
}
})