Skip to content

Commit

Permalink
chore: 添加画布右键菜单组件
Browse files Browse the repository at this point in the history
  • Loading branch information
wangrongding committed Apr 7, 2024
1 parent e13e355 commit 4d63701
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/components/player/ContextMenu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
type Menu = {
key: string // key
text: string // 文本
shortkey?: string // 快捷键
callback: () => void // 回调
}
defineProps<{ menuList: Menu[] }>()
const contextMenu = ref<HTMLElement | null>(null)
defineExpose({
contextMenu
})
</script>
<template>
<div
ref="contextMenu"
class="context-menu-container w-[200px] flex flex-col gap-1 absolute bg-[#1E1E29] border-[#505067] border text-[#D5D5E1] p-2"
>
<button
class="hover:bg-[#3B3B4F] text-left p-1 rounded-sm flex justify-between"
v-for="(item, index) in menuList"
:key="index"
@click="item.callback"
>
<span>{{ item.text }}</span>
<span v-if="item.shortkey">{{ item.shortkey }}</span>
</button>
</div>
</template>
<style lang="scss" scoped></style>
Empty file added src/utils/index.ts
Empty file.

0 comments on commit 4d63701

Please sign in to comment.