feat: using built-in gachaType

This commit is contained in:
mio
2023-05-11 20:31:24 +08:00
parent 0103a0fb4b
commit 69042728da
6 changed files with 292 additions and 10 deletions

View File

@ -79,6 +79,7 @@ import GachaDetail from './components/GachaDetail.vue'
import Setting from './components/Setting.vue'
import gachaDetail from './gachaDetail'
import { version } from '../../package.json'
import gachaType from '../gachaType.json'
const state = reactive({
status: 'init',
@ -158,11 +159,19 @@ const detail = computed(() => {
})
const typeMap = computed(() => {
const data = state.dataMap.get(state.current)
return data.typeMap
const gachaTypeMap = new Map(gachaType)
const type = gachaTypeMap.get(state.config.lang)
const result = new Map()
if (type) {
for (let { key, name } of type) {
result.set(key, name)
}
}
return result
})
const fetchData = async (url) => {
state.log = ''
state.status = 'loading'
const data = await ipcRenderer.invoke('FETCH_DATA', url)
if (data) {