From 4fdf39d2895fbd41f9eeb4b7fd65e3a2533a822a Mon Sep 17 00:00:00 2001 From: shuhang Date: Wed, 5 Jun 2019 16:36:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E5=B7=AEpromise=E5=AE=9E=E8=B7=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/worst-promise-practice.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 js/worst-promise-practice.js diff --git a/js/worst-promise-practice.js b/js/worst-promise-practice.js new file mode 100644 index 0000000..0a602a1 --- /dev/null +++ b/js/worst-promise-practice.js @@ -0,0 +1,23 @@ +//看到这些代码已经懒得改了... +export default class ActionInfo extends React.Component{ + emitSubmit=()=>{ + let {state,props} = this; + this.form.getFormData().then(formdata=>{ + this.setState({ + loading:true + }) + request('...',{ + body:formdata, + }).then(res=>{ + this.setState({ + loading:false, + }) + if(res.success){ + message.success('操作成功'); + this.closeModal(); + props.successCallback && props.successCallback(res.data); + } + }) + }) + } +} -- Gitee