我有 VUEJS 的形式:
<form @submit.prevent="commonPanelEntryRestore" method="post" action="url" onsubmit="heightGraph()">
</form>
我想在 vuejs @submit
事件完成后调用 heightGraph()
函数。
在 Vuejs 中可以吗?
最佳答案
您可以使用 Axios 库中的 finally 方法。
export default {
mounted() {
console.log('Component mounted.')
},
methods: {
commonPanelEntryRestore() {
axios.post(url, data).then(response => {
// success
}).catch(error => {
// error
}).finally(function() {
this.heightGraph()
})
},
heightGraph() {
}
}
}
关于javascript - 在 vuejs 中完成 @sumit.prevent 之后,有什么方法可以调用 onsumit 事件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57637667/