import CategoryTab from '@/utils/CategoryTab' import request from '@/utils/request' import { computed, defineComponent, inject, onMounted, ref, watch } from 'vue' import type { BackgroundType } from '../background/BackgroundSwtich' import clsx from 'clsx' import useLayoutStore from '../useLayoutStore' import { AddToToken } from './AdderPage' import { v4 as uuid } from 'uuid' import { Button } from 'ant-design-vue' const URL_ADDRESS = 'http://newfatfox.oss-cn-beijing.aliyuncs.com' interface GameType { id: string name: string rom: string playstation: string hot: number category: string despt: string icon: string } export const GameItem = defineComponent({ props: { content: { type: Object as () => GameType, required: true } }, setup(props) { const layout = useLayoutStore() const isGame = computed(() => layout.state.current === 0) const addTo = inject(AddToToken) return () => (
{props.content.name}
{props.content.despt}
) } }) export default defineComponent(() => { const layout = useLayoutStore() const loading = ref(false) const isGame = computed(() => layout.state.current === 0) const appList = ref([]) const selectType = ref('fc') watch( selectType, (val) => { loading.value = true request('GET', `/api/games?type=${val}`) .then((res) => { appList.value = res }) .finally(() => { setTimeout(() => { loading.value = false }, 200) }) }, { immediate: true } ) return () => (
{ selectType.value = e }} v-slots={{ select: (text: string) => ( ), unSelect: (text: string) => ( ) }} >
{!loading.value ? (
{appList.value.map((el) => ( ))}
) : (
{Array(12) .fill(0) .map((el, idx) => (
))}
)}
) })