JHCan333
2017-08-04 07:41react-redux项目出现问题,求解决
20最近刚开始做react-redux项目,不太熟悉,出了很多错,求大手子指点。
项目文件的目录大概这样
我在show2.html中引入了show2.js文件,show2.js文件中包含了react组件,show2.html的情况是这样
在show2.js中引入了一个react组件,show2.js中是这样写的,
所引入的charts是这样,
其中,引入的start是这样
import React, {Component} from 'react';
const echarts = require('echarts');
class Start extends Component {
constructor(props) {
super(props);
this.setChartOption = this.setChartOption.bind(this);
this.initChart = this.initChart.bind(this);
}
initChart() {
$.ajax({
url: this.props.url,
dataType: 'json',
cache: false,
success: function (data) {
let myChart = echarts.init(this.props.div);//初始化echarts
//我们要定义一个setPieOption函数将data传入option里面
console.log('22222');
//设置options
myChart.setOption(data);
// myChart.setOption(this.props.chartStyle);
}.bind(this),
error: function () {
alert('未获取到数据');
}.bind(this)
});
}
componentDidMount() {
this.initChart();
}
componentDidUpdate() {
this.initChart();
}
render() {
return null;
}
}
export default Start;
现在碰到的问题是这样!(数字是我测试用的,没有影响)
我刚开始在show2.js中使用的是import引入所需组件,报的是这样的错
最近刚开始做这方面的东西,现在我该怎么办啊?运行不起来,我也不知道哪里出错了,求大手子前辈指点
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- react 项目登录态如何设计?
- javascript
- react.js
- 1个回答
- 将授权用户从Laravel后端传递到React前端的最安全方式
- reactjs
- redux
- laravel
- php
- 2个回答
- dva.js怎么异步获取接口数据
- react.js
- 1个回答
- 我的react应用程序中的表单标签下载php文件。 怎么修?
- reactjs
- webserver
- apache
- php
- 1个回答
- react 滚动分页列表点击进入详细,然后点击回退按钮,怎么能使回来的页面保持离开前的位置和状态?
- react
- react-router-redux
- 1个回答
换一换