[[1, 2, 3, 4], [1, 2, 3], [1, 2]]
//我在ibos.js中只编写了一次axios方法,以及如何继承每个组件以及如何通过ibos.get()直接获得响应?............... .................................................. .................................................. .................................................. .................................................. .................................................. ...........................................
答案 0 :(得分:0)
class First extends React.Component {
first() {
alert("First")
}
render() {
return <div>sdfsdf</div>
}
}
class Second extends First {
second() {
alert('Second')
}
render() {
return <div>dsfsdfsdf</div>
}
}
class Third extends Second {
onButtonClick() {
super.second()
super.first()
}
render() {
return <button onClick={() => {this.onButtonClick()}}>Hello</button>;
}
}
ReactDOM.render(
<Third />,
document.getElementById('container')
);
&#13;
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id="container"></div>
&#13;
You should extend 'ibios' class instead of Chart Component in your child component and use keyword 'super' to use parent methods. Otherwise you can send it as props and use it
class BarChartComponent extends Ibios{
constructor(props){
super(props)
this.state={};
}
componentDidMount(){
//example
var url="http://localhost:9090",apiUrl="/reports",prametrs={xyz:ramki};
var retriveResponse=super.get(url,apiUrl,prametrs)
console.log(retriveResponse);
}
render(){
return(<p>hi......</p>);
}
}