获取数据:
service层
export async function key(params) {
return request(`${URL_PREFIX}/getPublicKey`, {
method: 'POST', data: params,
});
}
model层
* key({payload}, {call, put}) {
const response = yield call(key, payload);
return response;
},
index 层
const setKey = () => {
props.dispatch({
type: 'userManager/key'
}).then((result) => {
localStorage.setItem('publicKey', result.key);
setPublicKeyVelue(result);
});
}
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » react 前端框架中的 三层(service,model,index)具体操作
发表评论 取消回复