RightMenu.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="right-menu-mask" @click.stop="close()" @contextmenu.prevent="close()">
  3. <div class="right-menu" :style="{ 'left': pos.x + 'px', 'top': pos.y + 'px' }">
  4. <el-menu text-color="#333333">
  5. <el-menu-item v-for="(item) in items" :key="item.key" :title="item.name"
  6. @click.native.stop="onSelectMenu(item)">
  7. <!-- <span :class="item.icon"></span>-->
  8. <span>{{ item.name }}</span>
  9. </el-menu-item>
  10. </el-menu>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: "rightMenu",
  17. data() {
  18. return {}
  19. },
  20. props: {
  21. pos: {
  22. type: Object
  23. },
  24. items: {
  25. type: Array
  26. }
  27. },
  28. methods: {
  29. close() {
  30. this.$emit("close");
  31. },
  32. onSelectMenu(item) {
  33. this.$emit("select", item);
  34. this.close();
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss">
  40. .right-menu-mask {
  41. position: fixed;
  42. left: 0;
  43. top: 0;
  44. right: 0;
  45. bottom: 0;
  46. width: 100%;
  47. height: 100%;
  48. z-index: 9999;
  49. }
  50. .right-menu {
  51. position: fixed;
  52. border-radius: 8px;
  53. overflow: hidden;
  54. box-shadow: var(--im-box-shadow-light);
  55. .el-menu {
  56. border-radius: 4px;
  57. overflow: hidden;
  58. .el-menu-item {
  59. height: 36px;
  60. line-height: 36px;
  61. min-width: 100px;
  62. text-align: left;
  63. padding: 0 0 0 20px;
  64. &:hover {
  65. background-color: var(--im-background-active);
  66. }
  67. }
  68. }
  69. }
  70. </style>