0
使用JS库axios,为什么.then/.catch部分中的代码最终是否被渲染?axios then /在最后执行的catch代码
save(data) {
axios.put('/api/persons/1', data)
.then(response => {
alert('hello')
})
.catch(function(error) {
alert('goodbye')
})
alert('world')
}
此功能显示和2“你好”
我建议你看看承诺/异步代码......因为这是对异步编程的基本理解。 .then()和.catch()将在稍后运行。 – WilomGfx
谢谢@WilomGfx – Warrio