naive-ui
naive-ui copied to clipboard
组件内使用NFormItemGi组件无法渲染、是否应该找内层的NFormItemGi组件
问题的清晰而简明的描述
- 创建一个组件直接返回NFormItemGi 里面包个input啥的组件
- 在form组件中使用创建的组件
- 期望是渲染,可能是vnode没有去找嵌套的NFormItemGi组件
建议的解决方案
处理嵌套的NFormItemGi组件
备选方案
No response
附加上下文
No response
验证
提供的复现 最小可复现的示例
Provide a based on CodeSandbox or stackblitz [Minimal, Reproducible Example] (https://stackoverflow.com/help/minimal-reproducible-example)
import { NForm, NFormItemGi, NGrid, NGridItem, NInput } from "naive-ui";
import { defineComponent } from "vue";
import Child from "./components/Com";
const App = defineComponent({
setup() {
return () => (
<NForm
labelPlacement="left"
showFeedback={false}
style={{ marginLeft: "50px" }}
>
<NGrid cols={24} xGap={20} yGap={20}>
<NFormItemGi span={12}>
<NInput />
</NFormItemGi>
<Child />
</NGrid>
</NForm>
);
},
});
export default App;
import { NFormItemGi, NInput } from "naive-ui";
import { defineComponent } from "vue";
const Child = defineComponent({
setup() {
return (
<NFormItemGi span={6}>
<NInput />
</NFormItemGi>
);
},
});
export default Child;
很有可能像 grid 一样, NForm 子元素只能是 NFormItem
是这样的因为只找了一层没继续往下找 算是用法没用对 继续往下找也不现实