|
@@ -1,8 +1,9 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus'
|
|
|
-import { PropType, ref, unref } from 'vue'
|
|
|
+import { PropType, ref } from 'vue'
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
import { useDesign } from '@/hooks/web/useDesign'
|
|
|
+import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
|
|
|
|
|
const { getPrefixCls } = useDesign()
|
|
|
|
|
@@ -12,7 +13,7 @@ const { t } = useI18n()
|
|
|
|
|
|
const emit = defineEmits(['visibleChange'])
|
|
|
|
|
|
-defineProps({
|
|
|
+const props = defineProps({
|
|
|
schema: {
|
|
|
type: Array as PropType<contextMenuSchema[]>,
|
|
|
default: () => []
|
|
@@ -20,6 +21,10 @@ defineProps({
|
|
|
trigger: {
|
|
|
type: String as PropType<'click' | 'hover' | 'focus' | 'contextmenu'>,
|
|
|
default: 'contextmenu'
|
|
|
+ },
|
|
|
+ tagItem: {
|
|
|
+ type: Object as PropType<RouteLocationNormalizedLoaded>,
|
|
|
+ default: () => ({})
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -28,13 +33,14 @@ const command = (item: contextMenuSchema) => {
|
|
|
}
|
|
|
|
|
|
const visibleChange = (visible: boolean) => {
|
|
|
- emit('visibleChange', visible, unref(elDropdownMenuRef))
|
|
|
+ emit('visibleChange', visible, props.tagItem)
|
|
|
}
|
|
|
|
|
|
const elDropdownMenuRef = ref<ComponentRef<typeof ElDropdown>>()
|
|
|
|
|
|
defineExpose({
|
|
|
- elDropdownMenuRef
|
|
|
+ elDropdownMenuRef,
|
|
|
+ tagItem: props.tagItem
|
|
|
})
|
|
|
</script>
|
|
|
|