import { defineComponent, PropType } from '@vue/composition-api'; import './index.scss'; import { fixStyle } from '../../utils/dom'; export interface Option { title: string; command?: string; executor: () => void; } export interface Props { top: number; left: number; width: number; options: Option[]; } export const RightMenu = defineComponent({ functional: true, name: 'RightMenu', props: { top: { required: true, type: Number, }, left: { required: true, type: Number, }, options: { required: true, type: Array as PropType, }, }, render(_, { props }) { const { top, left, options } = props; return (
{options.map((option: Option) => (
{option.title} {option.command ? ( {option.command} ) : null}
))}
); }, });