dongfang
dongfang
> 业务自行实现的问题在于`List`组件已经添加了`prefixName`,在`List`中的`Item`会出现问题 > > 比如:https://codesandbox.io/s/prefixnamecontext-demo-m7l7pz @zombieJ 麻烦确认一下这个demo。`List`中的`Item`会同时接收到自定义的prefix和`List`内部的prefix
业务上在`List`中可能还会使用`PrefixProvider` 目前业务上的实现是:https://codesandbox.io/s/prefixnamecontext-demo-forked-kw8rub?file=/demo.tsx 虽然能实现,但是觉得为了避免和`List`的重复,实现起来和理解起来会很绕 感觉如果能够原生暴露出来会很方便
这样很清晰👍 不过业务上还有一个需求🤣。因为字段嵌套层级太深,如果字段之间有依赖关系时目前是使用相对路径的。 比如:`application.containers[0].metadata.annotations.lbcinstance`字段依赖`application.containers[0].metadata.annotations.bound`字段。 目前是通过`useContext(PrefixContext).fullpath`获取到完整前缀,比如`["application", "containers", 0, "metadata", "annotations"]`,然后`dependencies=[[...prefix, "bound"]]`。按照大佬上边的demo,`containers`是一个`List`,获取到的prefix只是`[0, "metadata", "annotations"]`这一段?