问题描述
在Reveal.js演示中,如何将React组件导入幻灯片?我有一张幻灯片在其他地方称为反应组件,它需要一个不同的组件。目前,我收到“跨组织请求被阻止”错误。例如:
从'./js/plotGen'导入plotgenerator
或在模拟示例中:
<div class="reveal">
<section>
<div id="reactstuff"></div>
</section>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<script>
Reveal.initialize({etc})
</script>
<script type="text/babel">
//create a react component here that would render in the above slide where the div id "reactstuff" is defined
//******problem
//I would like to import a component here to be run in this code,like below
import plotgenerator from './js/plotGen'
//******
class App extends React.Component {
constructor(props) {
super(props);
this.state = {null};
}
doSomething() {
}
render() {
return (
<div className="app">
<plotgenerator/>
</div>
);
}
}
ReactDOM.render(
<App />,document.getElementById('reactstuff')
);
</script>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)