naive-ui icon indicating copy to clipboard operation
naive-ui copied to clipboard

将 n-menu 组件的indent设置为0时选中样式异常

Open opcooc opened this issue 6 months ago • 3 comments

描述错误

将 n-menu 组件的indent设置为0时选中样式异常

复现步骤

1.代码: <n-menu v-model:value="activeKey" :root-indent="0" :indent="0" :options="menuOptions" /> 2.页面显示:

Image

最小复现链接

系统信息

"naive-ui": "^2.42.0","vue": "^3.5.16",

使用的包管理器

pnpm

验证

opcooc avatar Jun 17 '25 08:06 opcooc

你是想把菜单变成扁平化的样式吗

blackawn avatar Jun 19 '25 00:06 blackawn

你是想把菜单变成扁平化的样式吗

对 @blackawn

opcooc avatar Jun 19 '25 01:06 opcooc

你是想把菜单变成扁平化的样式吗

@blackawn

你可以这样

<template>
  <n-menu
    :root-indent="8"
    :indent="0"
    style="padding-left: 8px;"
  />
</template>
<style>
.n-menu .n-menu-item-content::before{
  left: 0!important;
}
</style>

或着:indent="-4", 我觉得0在有图标和没图标的情况下看起来匀称一些

blackawn avatar Jun 19 '25 04:06 blackawn