微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

manifest.js:将React组件导入到幻灯片中而没有跨源请求错误?

如何解决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.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?