import { defineComponent } from 'vue' import widgetList from '@/widgets' import { useMenuStore } from '../GlobalMenu' import type { Block } from '../layout.types' import useRouterStore from '@/useRouterStore' export default defineComponent({ props: { block: { type: Object as () => Block, required: true } }, setup(props) { const menu = useMenuStore() const router = useRouterStore() return () => { const placeholder = (
组件维护中
) const selected = widgetList.find((el) => el.name === props.block.name) if (!selected) return placeholder const compo = selected.list.find( (el) => el.w === props.block.w && el.h === props.block.h )?.component if (!compo) return placeholder return (
{ e.preventDefault() menu.open(props.block) }} onClick={() => { if (!selected.modal) return router.go(`widget-${props.block.name}`) }} >
) } } })