import { Button } from "ant-design-vue"; import { computed, reactive } from "vue"; import { IconImage, IconShape, IconTpl, IconVideo } from "@/assets/icons"; import { css, cx } from "@linaria/core"; import { IconCube } from "@queenjs/icons"; import { defineUI } from "queenjs"; import CustomComps from "./CustomComps"; import Shapes from "./Shapes"; import { Sources } from "./Sources"; import Templates from "./Templates"; const tabs = [ { title: "图片", icon: IconImage, content: [ { title: "平台", component: Sources, props: { sourceType: "Image", sourceFrom: "system" }, }, { title: "我的", component: Sources, props: { sourceType: "Image", sourceFrom: "user" }, }, ], }, { title: "形状", icon: IconShape, component: Shapes, }, { title: "视频", icon: IconVideo, content: [ { title: "平台", component: Sources, props: { sourceType: "Video", sourceFrom: "system" }, }, { title: "我的", component: Sources, props: { sourceType: "Video", sourceFrom: "user" }, }, ], }, { title: "组件", icon: IconCube, content: [ { title: "平台", component: CustomComps, props: { compType: "senior" }, }, { title: "我的", component: CustomComps, props: { compType: "user" }, }, ], }, { title: "模板", icon: IconTpl, component: Templates, }, ]; export default defineUI({ setup() { // @ts-ignore const state = reactive({ tabIndex: 0, compIndexs: [0, 0, 0, 0, 0], currentTab: computed(() => { return tabs[state.tabIndex]; }), currCompIndex: computed(() => { return state.compIndexs[state.tabIndex]; }), }); return () => { const { tabIndex, currentTab, currCompIndex } = state; const currComp = currentTab.component ? currentTab : currentTab.content?.[state.currCompIndex]; return (