From 33304257adc7886022bc60dd578f0d3d89667ff0 Mon Sep 17 00:00:00 2001 From: xingyu Date: Wed, 27 Sep 2023 10:30:12 +0800 Subject: [PATCH] fix: Fix context menu style not working --- .../ContextMenu/src/ContextMenu.vue | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/ContextMenu/src/ContextMenu.vue b/src/components/ContextMenu/src/ContextMenu.vue index dbdddf1..3243455 100644 --- a/src/components/ContextMenu/src/ContextMenu.vue +++ b/src/components/ContextMenu/src/ContextMenu.vue @@ -55,12 +55,12 @@ export default defineComponent({ const left = body.clientWidth < x + menuWidth ? x - menuWidth : x const top = body.clientHeight < y + menuHeight ? y - menuHeight : y return { - ...styles, position: 'absolute', width: `${width}px`, left: `${left + 1}px`, top: `${top + 1}px`, zIndex: 9999, + ...styles, } }) @@ -124,11 +124,9 @@ export default defineComponent({ const { items } = props return ( -
- - {renderMenuItem(items)} - -
+ + {renderMenuItem(items)} + ) } }, @@ -145,7 +143,7 @@ export default defineComponent({ .item-style() { li { display: inline-block; - width: 100%; + width: 100% !important; height: @default-height; margin: 0 !important; line-height: @default-height; @@ -154,7 +152,9 @@ export default defineComponent({ line-height: @default-height; } - > div { + >div { + width: 100% !important; + height: 100% !important; margin: 0 !important; } @@ -178,7 +178,7 @@ export default defineComponent({ background-color: var(--component-background); background-clip: padding-box; border: 1px solid rgb(0 0 0 / 8%); - border-radius: 0.25rem; + border-radius: 8px; box-shadow: 0 2px 2px 0 rgb(0 0 0 / 14%), 0 3px 1px -2px rgb(0 0 0 / 10%), @@ -187,6 +187,7 @@ export default defineComponent({ &__item { margin: 0 !important; } + .item-style(); .ant-divider {