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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...