VueJs:惯性事件侦听器不起作用

时间:2020-10-06 12:54:40

标签: vue.js inertiajs

我正在尝试将事件监听器与inertia.post一起使用,但是我无能为力。

this.$inertia.post('/email/store', data, {
    onStart: () => this.sending = true, 
    onFinish: () => this.sending = false,
})

实际帖子正在运行,并且已正确路由。但是没有其他事情发生。 除此之外,我还有什么要做的吗?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。不幸的是,它不能像记录的那样工作。 :(

由于该方法返回了Promise,因此您可以这样解决:

this.sending = true
this.$inertia.post('/email/store', data)
  .then(() => this.sending = false);

编辑: Events have been introduced with version 0.3。您使用的是哪个版本?