reactjs - 如何使用 create-react-app 将样式导入 iframe?
问题描述
我正在使用 CRA (create-react-app) 创建一个网站。在这个网站中,我使用 React.createPortal 将组件注入到 iframe 中,如下所示:
ReactDOM.createPortal(
<SomeComponent />,
this.iframeRef.current.contentDocument.body
);
但是样式显然没有传递到 iframe 中。像这样:https ://codesandbox.io/s/kk05rl6kpv 。
关于如何将样式表块移动到 iframe 中的任何想法?
解决方案
推荐阅读
- raspberry-pi3 - Rasperry PI 3+ 上的 InfluxDB 1.7.x 高 CPU 使用率
- python - 基于python中的字符串值标记数据
- c# - 使用 Prism/MVVM 实例化新的 View/ViewModel 实例
- linq - EF Core 2.2 在加入多列时意外生成 SQL
- c++ - 为什么&符号运算符仅有时用于在 C++ 中分配指针?
- azure - 天蓝色中没有 NAT 的 NVA 用于 INTERNET 访问
- hadoop - ParseException line 6:5 无法识别 joinSource 中 '(' 'SELECT' 'system' 附近的输入
- c++ - 将 std::unique_ptr 推回 std::vector 时编译器不会失败
- sql - 在另一个查询中使用 WITH 结果
- java - 如何将上下文传递给静态方法?