promise是异步编程的解决方案,它的写法比jquery里面的$.ajax()要好,没有嵌套,例子:
let f=()=>{
return new Promise((res,rej)=>{
res();
})
}
let 0=f();
o.then.then.then
o.then.then.then 相当于o.sucess().sucess().sucess()
这种写法比较优雅
promise是异步编程的解决方案,它的写法比jquery里面的$.ajax()要好,没有嵌套,例子:
let f=()=>{
return new Promise((res,rej)=>{
res();
})
}
let 0=f();
o.then.then.then
o.then.then.then 相当于o.sucess().sucess().sucess()
这种写法比较优雅
转载于:https://www.cnblogs.com/hsgg/p/8067222.html