In a Vue component:
import { someRequestMethod } from '@/api/requ'
...
methods: {
testMethod() {
someRequestMethod(someRequestData).then(function() {
this.outMethod_01()
}).then(function() {
this.outMethod_02()
})
}
outMethod_01() {
console.log('I am an outer method 01.');
}
outMethod_02() {
console.log('I am an outer method 02.');
}
}
when I call testMethod, with a Promise response.
then I want to call outMethod_01 if succeed, outMethod_02 if got error.
but i got error outMethod_01 is undefined and outMethod_02 is undefined.
so how to call a outer method in the Promise?