我已经在 Laravel 8 Inertia 和 Vue.js 项目上工作了几周,没有遇到这个问题。我的文件位于 C:\Users[my_user]\laravel 中。我使用 artisan 命令服务,它打开 127.0.0.1:8080 作为本地开发服务器——一切都很好。我决定是时候将文件传输到 apache 的 http://localhost/laravel,在那里我将使用 xampp 打开项目而不是 Laravel php artisan 命令服务。我已经检查了我的路线、控制器,通过了 Inertia::render() 命令,到达了 app.js,没有任何问题。但是当我运行 createInertiaApp() 时,我发现 url 部分被重复,我猜是 Inertia 而不是 vue.js 这是我在 app.js 中的代码
console.log('Still working well without duplicating url')
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => require(`./Pages/${name}.vue`),
setup({ el, app, props, plugin }) {
return createApp({ render: () => h(app, props) })
.use(plugin)
.component('Link', Link)
.component('Head', Head)
.mixin({ methods: { route } })
.mount(el);
}, …Run Code Online (Sandbox Code Playgroud) 当我尝试从 html 表单将数据发布到 PHP 时,我遇到了问题。问题如下: