登录  /  注册
Inertia.js 中删除路由无法触发 onSuccess() 回调
P粉738346380
P粉738346380 2023-12-26 08:57:49
[Vue.js讨论组]

我有一个删除路由 Inertia.js,这样当我删除一个项目时,它会重定向回我所在的页面。但是,这并不是在 Inertia destroy 路由中调用 onSuccess() 函数。

示例.vue

deleteSubmit(id) {
    this.accountsDataTable.destroy();
    Inertia.destroy(route('installers.destroy', {id: id}), {}, { 
        preserveState: true, 
        onSuccess: () => {
            this.accountsDataTable = $('#table').DataTable({
                columnDefs: [{
                    target: 1
                }]
            });
        }
    })
},

ExampleController.php

//Validate the request
//Create the installer
//Redirect back on success
return redirect()->route('installers.index')->with('success', 'Installer was successfully deleted.');

但是,数据表没有按照我想要的方式重新创建。这是之前的样子:

正确的图像

之后的情况是这样的:

图片错误

我尝试将控制器代码更改为:

return redirect()->back()->with('success', 'Installer was successfully deleted');

但是数据表仍然没有按应有的方式显示。

P粉738346380
P粉738346380

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2024 //m.sbmmt.com/ All Rights Reserved | php.cn | 湘ICP备2023035733号