fix: Fix context menu style not working

pull/38/head
xingyu 2023-09-27 10:30:12 +08:00
parent 8bea32cd84
commit 33304257ad
1 changed files with 10 additions and 9 deletions

View File

@ -55,12 +55,12 @@ export default defineComponent({
const left = body.clientWidth < x + menuWidth ? x - menuWidth : x const left = body.clientWidth < x + menuWidth ? x - menuWidth : x
const top = body.clientHeight < y + menuHeight ? y - menuHeight : y const top = body.clientHeight < y + menuHeight ? y - menuHeight : y
return { return {
...styles,
position: 'absolute', position: 'absolute',
width: `${width}px`, width: `${width}px`,
left: `${left + 1}px`, left: `${left + 1}px`,
top: `${top + 1}px`, top: `${top + 1}px`,
zIndex: 9999, zIndex: 9999,
...styles,
} }
}) })
@ -124,11 +124,9 @@ export default defineComponent({
const { items } = props const { items } = props
return ( return (
<div class={prefixCls}> <Menu inlineIndent={12} mode="vertical" class={prefixCls} ref={wrapRef} style={unref(getStyle)}>
<Menu inlineIndent={12} mode="vertical" ref={wrapRef} style={unref(getStyle)}> {renderMenuItem(items)}
{renderMenuItem(items)} </Menu>
</Menu>
</div>
) )
} }
}, },
@ -145,7 +143,7 @@ export default defineComponent({
.item-style() { .item-style() {
li { li {
display: inline-block; display: inline-block;
width: 100%; width: 100% !important;
height: @default-height; height: @default-height;
margin: 0 !important; margin: 0 !important;
line-height: @default-height; line-height: @default-height;
@ -154,7 +152,9 @@ export default defineComponent({
line-height: @default-height; line-height: @default-height;
} }
> div { >div {
width: 100% !important;
height: 100% !important;
margin: 0 !important; margin: 0 !important;
} }
@ -178,7 +178,7 @@ export default defineComponent({
background-color: var(--component-background); background-color: var(--component-background);
background-clip: padding-box; background-clip: padding-box;
border: 1px solid rgb(0 0 0 / 8%); border: 1px solid rgb(0 0 0 / 8%);
border-radius: 0.25rem; border-radius: 8px;
box-shadow: box-shadow:
0 2px 2px 0 rgb(0 0 0 / 14%), 0 2px 2px 0 rgb(0 0 0 / 14%),
0 3px 1px -2px rgb(0 0 0 / 10%), 0 3px 1px -2px rgb(0 0 0 / 10%),
@ -187,6 +187,7 @@ export default defineComponent({
&__item { &__item {
margin: 0 !important; margin: 0 !important;
} }
.item-style(); .item-style();
.ant-divider { .ant-divider {