Ich habe eine App, die Axios verwendet und die Werte (zB: ID und warehouseName) mit Hilfe von Map rendern, die ich auf Tabs lege. Jetzt möchte ich einen Zustand auf warehouseID
bei loadBrandTotal()
von der Wert-ID, die ich in der Karte bekomme.Reaction -Render Werte onClick von Tabs
Bisher ist mein Code wie folgt viel im Voraus
export default React.createClass({
getInitialState(){
return {
warehouseName: ""
}
},
componentWillMount(){
this.loadWarehouse();
this.loadBrandTotal();
},
loadWarehouse(){
var that = this
var url = api + 'retrieveWarehouseList';
axios.post(url,
{
warehouseName : 'NONE'
})
.then(function (response) {
console.log(response.data);
that.setState({
warehouseList : response.data.retrieveWarehouseListResult
});
})
.catch(function (response) {
console.log(response);
});
},
loadBrandTotal(){
var that = this
var url = api + 'retrieveTotalSalesPerBrand';
axios.post(url,
{
warehouseID : "None"
})
.then(function (response) {
console.log(response.data);
that.setState({
totsalesperbrand : response.data.retrieveTotalSalesPerBrandResult
});
})
.catch(function (response) {
console.log(response);
});
},
render() {
var wareName = this.state.warehouseList;
return (
\t <ul className="tabs tabs-transparent">
\t {wareName.map(function(nameoObjects) {
\t return (
\t <li className="tab">
\t <a href="#test1" value={nameoObjects.ID} key={nameoObjects.ID}>{nameoObjects.warehouseName}</a>
\t </li>
\t )
\t })}
\t </ul>
\t)}
})
Dank.