//由于需要请求接口,接口是异步的,得转换成同步后才能进行下步操作,否则数据会错乱
function checkStatus(data) {
return new Promise((resolve, reject) => {
axios.post('xxx', data).then(_data => {
resolve(_data.status)
})
})
}
async function doSth() {
let next = () => {
// do sth...
}
let res_status = await checkStatus(one_msg.check_item_id);
if (res_status) next();
}
©2018-2020 hongshali.com 版权所有 ICP证:闽ICP备18029655号-1