Boss, I want to finally get a return value. Instead of a promise, you can understand the two functions above as the asynchronous return of the request interface
Boss, I want to finally get a return value. Instead of a promise, you can understand the two functions above as the asynchronous return of the request interface
async function returns a Promise object.
async the value returned by the return statement inside the function becomes the parameter of the callback function of the then method.
async function f() {
return 'hello world';
}
f().then(v => console.log(v))
// "hello world"
const onefunc = async () => {
return await new Promise( resolve => {
setTimeout(()=>{
resolve("");
}, 1000);
});
}
const getData = async () => {
let data = await onefunc();
console.log(data);
return data;
}
getData();
can someone explain what this operation is all about? It s okay to refresh the browser again!? ...
at present, when Mini Program s wepy framework component acquires a global globaldata object, it needs this.$parent.$parent; . Is there any way to do function processing in a file, and which gloabaldata object can you directly go to when this function i...
at present, when Mini Program s wepy framework component acquires a global globaldata object, it needs this.$parent.$parent; . Is there any way to do function processing in a file, and which gloabaldata object can you directly go to when this function i...
Boss, I want to finally get a return value. Instead of a promise, you can understand the two functions above as the asynchronous return of the request interface ....
Boss, I want to finally get a return value. Instead of a promise, you can understand the two functions above as the asynchronous return of the request interface ....