javascript - 在 vuejs 中完成 @sumit.prevent 之后,有什么方法可以调用 onsumit 事件吗?

标签 javascript laravel vue.js

我有 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/

相关文章:

php - 通过函数传递参数时出错。

javascript - Mongoose 更新不起作用

php - 如何使用 Laravel Vapor 发布 list 文件

javascript - OverlappingMarkerSpiderfier 显示 'spiderfy cluster' 中有哪些标记?

javascript - 是否可以在 es6 模板字符串中进行评论?

php - Laravel 检查返回站点

laravel - 如何在 laravel 模块中进行迁移?

javascript - 如何在 Javascript 中将方法转换为递归函数?

javascript - javascript切换淡入淡出效果

google-maps - 如何使用 VueJs 在 Google map 中添加我的位置按钮?