最近在學習antdesignpro這個平臺,自己嘗試修改頁面,在model中已經獲取到了介面資料并傳給了Index,但是要怎樣才能把資料替換成自己的介面資料呢,當前的this.props是這樣的
uj5u.com熱心網友回復:
比如你model里面資料以及獲得并保存在狀態里面,這個串列拿到對應的狀態屬性賦值,你就可以吧新拿到資料替換你保存在 狀態(state)里面的資料就行啦uj5u.com熱心網友回復:
翻了一下CSDN,看到了你的這篇帖子,現在已經會了吧
還是說一下,步驟就是設定變數接收資料,最后遍歷賦值
this.state = {
StoreList: [],
}
_me.props.dispatch({
type: 'appStore/getApp',
payload: postJson,
callback: json => {
//json = json.data;
if (json.errCode == '20000') {
_me.setState({
StoreList: json.Data,
})
} else {
Message.error(json.errMsg);
}
}
});
this.state.StoreList.map((item, i) => {
items.push(
);
});
uj5u.com熱心網友回復:
一般都是這樣的初始化的時候 你index 內的某些值從state中 取,然后根據你操作和后臺操作取到的值取更新具體的值
前端會把接收的值存更新state 而你的某些text/input。。。。 則取state中的值
constructor(props) {
super(props);
this.state = {
mode: 1,
selectedRowKeys: [],
addMaterialModelVisible: false,
resizable: true,
frameFilePath: '',
};
}
例如這樣,
然后在某些事件中更新這些值
back=() => {
this.setState({ mode: 1 });
};
具體怎么用你搜搜都有
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/68786.html
標籤:其他
上一篇:The origin server did not find a current representation for the target resource
