我正在尝试将 postmessage 从打开的窗口发送到 facebook 应用程序浏览器中的 opener,但“opener 窗口”从不接收消息。问题的原因是什么?
接收端:
window.addEventListener('message', function (e) {
window.console.log("on message: " + e.data);
}, false)
Run Code Online (Sandbox Code Playgroud)
发送方:
window.opener.postMessage('any Message', document.location.origin);
Run Code Online (Sandbox Code Playgroud) 我想做什么?
我已经有 WYSIWYG 来创建一些小的 html 页面,稍后它发送请求以在后端保存该 html 页面。所以我需要添加 css 来请求从父页面添加所有样式(页面中包含编辑器)
题
如何将 css 文件作为原始字符串导入以将其添加到以后的请求类型中?
<style>
styles...
</style>
Run Code Online (Sandbox Code Playgroud)
我现在有什么?
我有由https://github.com/facebook/create-react-app创建的项目
import css from './public/someFile.module.css';
...
class App extends Component {
componentDidMount() {
console.log(css);
}
Run Code Online (Sandbox Code Playgroud)
但它记录像对象:
{jodit: "jodit_jodit__zIMF7", jodit_container: "jodit_jodit_container__opKkw", jodit_workplace: "jodit_jodit_workplace__1FVd6", jodit_wysiwyg: "jodit_jodit_wysiwyg__35mmG", jodit_wysiwyg_iframe: "jodit_jodit_wysiwyg_iframe__1-Yky", …}
Run Code Online (Sandbox Code Playgroud)