Promise 对象
数据的过滤处理
const promise = new Promise(function(resolve, reject) {
axios({
method: 'get',
baseURL: 'http://www.cmarket-api.com:808/goods',
headers: {Authorization:"Bearer cgJhxq5NWeBSryo9IX1cFqZu4hyko0XgylGl83NB"},
}).then((res) => {
resolve(res);
}).catch((err) => {
reject(err);
})
});
promise.then(function(val){
console.log(val)
}).catch(function(err){
console.log(err)
})
var p = new Promise(function(resolve, reject){
setTimeout(function(){
console.log('执行完成');
resolve('随便什么数据');
}, 2000);
});
function kk(){
return p
}
kk().then(function(){
console.log(1111)
})

浙公网安备 33010602011771号