wangrong
2026-08-30 4c949c0dc9bcae785c281c9d8125295f09810b15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<script lang="ts" setup>
import { Icon } from '@/components/icon-custom'
import icon_more_outlined from '@/assets/svg/icon_more_outlined.svg'
import type { Placement } from 'element-plus-secondary'
 
export interface Menu {
  svgName?: string
  label?: string
  command: string
  divided?: boolean
  disabled?: boolean
}
 
withDefaults(
  defineProps<{
    menuList: Array<Menu[]>
    placement?: Placement
    iconName?: any
    iconSize?: string
    inTable?: boolean
  }>(),
  {
    placement: 'bottom-end',
    iconSize: '16px',
    inTable: false
  }
)
 
const handleCommand = (command: string | number | object) => {
  emit('handleCommand', command)
}
 
const emit = defineEmits(['handleCommand'])
</script>
 
<template>
  <el-dropdown
    popper-class="menu-more_popper"
    :placement="placement"
    :persistent="false"
    trigger="click"
    @command="handleCommand"
  >
    <el-icon class="hover-icon" :class="inTable && 'hover-icon-in-table'" @click.stop>
      <Icon><component class="svg-icon" :is="iconName || icon_more_outlined"></component></Icon>
    </el-icon>
    <template #dropdown>
      <el-dropdown-menu :persistent="false">
        <el-dropdown-item
          :divided="ele.divided"
          :command="ele.command"
          v-for="ele in menuList"
          :key="ele.label"
          :disabled="ele.disabled"
        >
          <el-icon class="handle-icon" :style="{ fontSize: iconSize }" v-if="ele.svgName">
            <Icon><component class="svg-icon" :is="ele.svgName"></component></Icon>
          </el-icon>
          {{ ele.label }}
        </el-dropdown-item>
      </el-dropdown-menu>
    </template>
  </el-dropdown>
</template>
 
<style lang="less">
.menu-more_popper {
  margin-top: -2px !important;
  .handle-icon {
    color: #646a73;
  }
}
</style>