Open guoqirong opened 1 year ago
React Devtools 看下 Provider 和组件获取到的属性值看看?
子系统打包后的用ng挂载的,是不是notification在ts里直接使用,识别不了ConfigProvider的配置呢?
Notification 和 Message 这种非 React 渲染流中的组件是读不到流中的配置的
那有没有单独修改Notification挂载组件的方法呢?
Tea 有一个全局的 setConfig()
方法,可以试试
能给个示例吗
移掉 ConfigProvider
中的 popupContainer
配置,在渲染前调用 setConfig
import { setConfig } from 'tea-component';
setConfig({ popupContainer: xxx })
但是其实在 ConfigProvider 首次设置的时候,也同步了全局配置,所以建议还是先看看为什么没取到,也可以到 node_modules 下源码调试看看
React Devtools 看下 Provider 和组件获取到的属性值看看?
显示div,看不出是哪里的
显示div,看不出是哪里的
记得右键能 save 成变量查看的
{ "value": { "popupContainer": "
", "locale": "zh-CN" }, "children": "Store as global variable 就能在 Console 查看了
这里拿到的是在子系统里的,但Notification没有获取到这个值
稍等,我调整一下这里取值方式打个包试试
这里从 Context 读确实会有点问题,准备新增 notification.config()
和 message.config()
方法支持单独配置 popupContainer
等属性
好的,这个大概什么时候可以给出,是整个项目配置一次就可以吗?
是的 设置是全局的,这周会打个 @beta 包
大佬,这个@beta 包今天能给,还是要下周呢?
tea-component@2.7.9-beta.2
message.config({ popupContainer: () => document.querySelector("xx") });
notification.config({ popupContainer: () => document.querySelector("xx") });
你这个配置后,重新从tea组件引入要重新配置吗?我这边不配置不生效的,试了一下配成全局状态存储message和notification也不生效
引入的是同一份的话是不需要的
是同一份,当不生效啊
可以了,之前的导出从tea-component/lib,可能是这个造成的,谢谢大佬
子系统做了挂载节点配置,但不生效