-1👍
Please check the content of "this" – i think you won’t find any content you’d expect, when you’re inside the promise.
This should help you out:
let tempThis = this;
...
.then((res) => {
tempThis.$emit('closeModal'); //<-- This line does work now
keep in mind that you could also use async/await (ES6) here, where this "problem" does not occur but you’d have to check the status of the response yourself so it would otherwhise not be that much easier to read or anything
- [Vuejs]-Vue conditional css does not always trigger
- [Vuejs]-Nginx can't load css, js from webpack output
Source:stackexchange.com