【问题标题】:Route with multiple parameter InertiaJS多参数 InertiaJS 路由
【发布时间】:2021-05-12 08:17:46
【问题描述】:

我正在使用带有 InertiaJS 堆栈的 Laravel 8。

我在路由和资源控制器上使用模型绑定。

是否可以在惯性中在 route() 函数上发送多个参数?

我无法收到this.$inertia.put(route("rooms.update", this.form)); 发送的请求(this.form)

这是我在控制器中的功能

/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Room  $room
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Room $room)
    {
        dd($room, $request->all());
    }

这是vue文件的惯性方法

this.$inertia.put(route("rooms.update", this.form));

【问题讨论】:

    标签: vue.js laravel-8 inertiajs


    【解决方案1】:

    试试这个:

    this.$inertia.put(route("rooms.update", this.room), this.form);
    

    假设room存在于props中并且是编辑室。

    【讨论】:

      【解决方案2】:

      nvm,我设法把它改成这个

      this.$inertia.put(
                route("rooms.update", { room: this.editingRoomUuid }),
                this.form
              );
      

      【讨论】:

        猜你喜欢
        • 2013-11-03
        • 2017-04-09
        • 2020-05-31
        • 1970-01-01
        • 2015-02-25
        • 2018-03-20
        • 1970-01-01
        • 1970-01-01
        • 2017-12-03
        相关资源
        最近更新 更多