diff --git a/js/worst-promise-practice.js b/js/worst-promise-practice.js new file mode 100644 index 0000000000000000000000000000000000000000..0a602a1f45506af4f8d20c85a088b77ce9de54d7 --- /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); + } + }) + }) + } +}