В компоненте Vue:
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.');
}
}
, когда я звоню testMethod
, с ответом Promise
.тогда я хочу позвонить outMethod_01
, если получится, outMethod_02
, если получит ошибку.но я получил ошибки outMethod_01 is undefined
и outMethod_02 is undefined
.
, так как вызвать внешний метод в Promise
?