feat: 增加右键菜单功能及处理逻辑

This commit is contained in:
tnt group
2022-09-28 16:47:12 +08:00
parent e559ca928a
commit 634b5c2bea
10 changed files with 212 additions and 62 deletions
+41 -2
View File
@@ -7,7 +7,18 @@ import { MenuOptionsItemType } from './useContextMenu.hook.d'
import { MenuEnum } from '@/enums/editPageEnum'
import cloneDeep from 'lodash/cloneDeep'
const { CopyIcon, CutIcon, ClipboardOutlineIcon, TrashIcon, ChevronDownIcon, ChevronUpIcon } = icon.ionicons5
const {
CopyIcon,
CutIcon,
ClipboardOutlineIcon,
TrashIcon,
ChevronDownIcon,
ChevronUpIcon,
LockOpenOutlineIcon,
LockClosedOutlineIcon,
EyeOutlineIcon,
EyeOffOutlineIcon
} = icon.ionicons5
const { UpToTopIcon, DownToBottomIcon, PaintBrushIcon, Carbon3DSoftwareIcon, Carbon3DCursorIcon } = icon.carbon
const chartEditStore = useChartEditStore()
@@ -17,7 +28,7 @@ const chartEditStore = useChartEditStore()
* @param {number} n > 2
* @returns
*/
export const divider = (n:number = 3) => {
export const divider = (n: number = 3) => {
return {
type: 'divider',
key: `d${n}`
@@ -26,6 +37,34 @@ export const divider = (n:number = 3) => {
// * 默认单组件选项
export const defaultOptions: MenuOptionsItemType[] = [
{
label: '锁定',
key: MenuEnum.LOCK,
icon: renderIcon(LockClosedOutlineIcon),
fnHandle: chartEditStore.setLock
},
{
label: '解除锁定',
key: MenuEnum.UNLOCK,
icon: renderIcon(LockOpenOutlineIcon),
fnHandle: chartEditStore.setUnLock
},
{
label: '隐藏',
key: MenuEnum.HIDE,
icon: renderIcon(EyeOffOutlineIcon),
fnHandle: chartEditStore.setHide
},
{
label: '显示',
key: MenuEnum.SHOW,
icon: renderIcon(EyeOutlineIcon),
fnHandle: chartEditStore.setShow
},
{
type: 'divider',
key: 'd0'
},
{
label: '复制',
key: MenuEnum.COPY,