Comments (7)
@heihachi88 This example code is true. Try to check your fetchData
function again. It return Promise right ?
from vue-element-loading.
fetchData: _.debounce(function (offset = false) {
// console.log(offset)
axios.get(globalConfig.ORDERS_URL, {
withCredentials: true,
headers: {
'Authorization': auth.getAuthHeader()
}
})
.then((resp) => {
this.req = resp.data
// console.log(resp)
})
.catch((err) => {
console.log(err)
if (err.response.status === 403) {
auth.logout()
}
})
}, 500),
from vue-element-loading.
@heihachi88
You must set async/await in your function.
fetchData: async _.debounce(async (offset = false) => {
await axios.get...
}, 500)
from vue-element-loading.
With await
it's going to wait until i get response from get reqeust?
from vue-element-loading.
@heihachi88 Yes
from vue-element-loading.
it's not possible to set await
inside a function, as you described above, it returns an error:
Syntax Error: await is a reserved word (311:6)
from vue-element-loading.
This is not problem of vue-element-loading, Your problem is async/await function. You can learn more about it here.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
from vue-element-loading.
Related Issues (20)
- It would be great if we can pass text with loading also ? :) HOT 1
- Invalid default value for prop testStyle HOT 8
- use typescript in this library ? HOT 1
- Minified version was not updated ! HOT 3
- Not working in IE 11 - getting Script Syntax error HOT 12
- 不兼容Android低版本 HOT 3
- Size is not taking effect HOT 3
- Set default config HOT 5
- Arrow function not transpiled in vue-element-loading.min.js HOT 3
- Old Versions
- [Feature request] Loader delay HOT 5
- compatibility with Vue 3? HOT 12
- IE11 compatibility issue (sintax error)
- fully featured live demo is down HOT 1
- npm version 2.0.1 is latest now not working on vue 2 HOT 2
- Can we have esm build for cdn usage ?
- SSR ReferenceError: document is not defined HOT 7
- Functions HOT 1
- Bootstrap modal z-index HOT 2
- change Background Color HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-element-loading.