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