import { computed, defineComponent, onMounted, ref, watch, } from 'vue' import useLayoutStore from '../useLayoutStore' import { OhVueIcon, addIcons } from 'oh-vue-icons' import clsx from 'clsx' import { BiChevronLeft } from "oh-vue-icons/icons"; import CategoryTab from '@/utils/CategoryTab'; import { BiChevronDown } from "oh-vue-icons/icons"; import request from '@/utils/request'; addIcons(BiChevronLeft, BiChevronDown) const typeList = [ '热门', 'COSPALY', '二次元', '风景', '插画', '热门', 'COSPALY', '二次元', '风景', '插画', '热门', 'COSPALY', '二次元', '风景', '插画' ] export type BackgroundType = { id: string oridinal: number type: string } export default defineComponent(() => { const layout = useLayoutStore() const isGame = computed(() => layout.state.current === 0) const selectType = ref('') const addTo = ref(layout.state.currentPage) const typeList = ref([]) const sortBy = ref<'hotNum' | 'time'>('hotNum') onMounted(() => { request("GET", "/api/backgroundTypes").then(res => { console.log(res); typeList.value = res selectType.value = res[0].id }) }) watch(() => [selectType.value, sortBy.value], (e) => { request("GET", `/api/backgrounds?typeId=${e}&sort=${sortBy.value}`).then(res => { console.log(res); }) }, { immediate: true }) return () => (
壁纸库
) })