import { defineComponent } from 'vue' import type { Block } from '../layout.types' import { useMenuStore } from '../GlobalMenu' import jump from '@/utils/jump' export default defineComponent({ props: { block: { type: Object as () => Block, required: true }, brief: { type: Boolean, default: false }, dock: { type: Boolean, default: false } }, setup(props) { const menu = useMenuStore() if (props.block.w === 1 && props.block.h === 1) { return () => (
{ menu.open(props.block) }} onClick={() => { jump(props.block.link) }} style={{ backgroundColor: props.block.background || 'white', color: props.block.color || 'black', backgroundImage: props.block.icon ? `url('${props.block.icon}')` : '', fontSize: props.dock ? '16px' : props.brief ? '12px' : 'calc(var(--block-size) / 5)' }} >
{props.brief ? props.block.text[0] : props.block.text}
) } else { return () => (
{ menu.open(props.block) }} onClick={() => { window.open(props.block.link, '_blank') }} style={{ backgroundImage: `url('/tab/bg/game.webp')` }} > game icon
{props.block.label}
game_icon
) } } })