//这两个一定要引入
import React, { useEffect } from 'react';
import * as echarts from 'echarts';
class PieLine extends React.Component{
state = { monitorList: [] };
//这里不懂生命周期的回去复习一下,我这边直接在这里调接口
componentDidMount() {
const { getEventType, dispatch } = this.props;
dispatch({
type: TYPE, //TYPE就是接口
payload: {},
}).then(resultObject => { //这边就是返回值,然后把值接一下
this.setState({
monitorList: resultObject, //在state全局里面存一下
});
});
if (getEventType) {
getEventType();