首页 > 解决方案 > 在 VueJS 和 Laravel 中使用 Axios 响应后无法访问 InertiaJS 道具

问题描述

在 VueJS 中使用 Axios 发出下一个请求

axios.post('route-of-the-method'), {
    data,
}).then((res) => {
    self.$vs.notification({
        title: this.$page.props.language.section.success,
        text: this.$page.props.language.section.action_done,
    });
...

然后控制器的响应是下一个:

return response()->json(true);

所以看起来很简单,它应该正确启动通知,但它崩溃了,因为 vue 无法从惯性读取阴影道具。

我正在执行 Axios 请求而不是惯性请求,因为我正在与另一个应用程序共享该方法。

标签: laravelvue.jsvuejs2inertiajs

解决方案


推荐阅读