前端如何拿到后端数据?
在前后端通信过程中,一般使用一些异步机制来处理请求和响应 (更好的用户体验-不堵塞程序). 后端可以返回前端一个promise
Promise的三种情况
A
Promise
is in one of these states:- pending: initial state, neither fulfilled nor rejected.
- fulfilled: meaning that the operation was completed successfully.
- rejected: meaning that the operation failed.