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

更新到最新2.38.2版本后,form表单中inline模式下select组件宽度没有了

Open a1113590485 opened this issue 1 year ago • 1 comments
trafficstars

描述错误

更新到最新2.38.2版本后,form表单中inline模式下select组件宽度没有了

复现步骤

<n-form
            ref="formRef"
            inline
            label-placement="left"
            :model="filterFormData"
            :show-feedback="false"
          >
            <n-form-item label="类型" path="categoryId">
              <n-select clearable
                v-model:value="filterFormData.categoryId"
                label-field="categoryName_Default"
                value-field="code"
                :options="categoryOptions"
                :consistent-menu-width="false"
              />
            </n-form-item>
</n-form>

其中n-select宽度没有了 企业微信截图_17183296619886

最小复现链接

系统信息

使用的包管理器

npm

验证

a1113590485 avatar Jun 14 '24 01:06 a1113590485

提供的复现 最小可复现的示例

jahnli avatar Jun 14 '24 13:06 jahnli

This issue does not have any recent activity. If you are still experiencing similar problems, open a new error, including a minimal copy of the problem

jahnli avatar Aug 11 '24 16:08 jahnli

提供的复现 最小可复现的示例

https://codesandbox.io/p/devbox/jx623d @jahnli

tinywaves avatar Jan 17 '25 07:01 tinywaves

提供的复现 最小可复现的示例

https://codesandbox.io/p/devbox/jx623d @jahnli

https://github.com/tusen-ai/naive-ui/issues/5014

tinywaves avatar Jan 17 '25 08:01 tinywaves

看样子是有点问题

jahnli avatar Jan 17 '25 08:01 jahnli

@tinywaves 好像与初始值是 null 或者 undefined 有关

jahnli avatar Jan 17 '25 08:01 jahnli

@tinywaves 好像与初始值是 null 或者 undefined 有关

是的,不过在表单里初始值设置为零值算是常见需求。而且似乎是父级必须要给定一定的宽度限制渲染才会正常,比如:https://www.naiveui.com/zh-CN/os-theme/components/form#left.vue 官方这边是否考虑给一个初始值或者想个办法去动态计算一下宽度啥的。

tinywaves avatar Jan 19 '25 16:01 tinywaves