如何解决manifest.js:将React组件导入到幻灯片中而没有跨源请求错误?
在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 举报,一经查实,本站将立刻删除。