gpt4 book ai didi

Laravel 8 (Inertia js) - 获取 Vue 错误 'app.js:30559 [Vue warn]: Error in created hook: "错误 : Cannot find module. ..'

转载 作者:行者123 更新时间:2023-12-03 23:20:06 30 4
gpt4 key购买 nike

我已经设置了一个使用 Jetstream(惯性 js 堆栈)的 Laravel 8 安装。 Jetstream 提供的所有 View 都正常工作。
问题是当我创建一个呈现新 Vue 模板的新路由时,我在控制台中收到此错误:app.js:30559 [Vue warn]: Error in created hook: "Error: Cannot find module './Test'"我的路线在 web.php 中创建

Route::get('/test', function() {
return Inertia\Inertia::render('Test');
});
“Test.vue”文件位于“resources/js/Pages”目录中。
<template>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
Testing
</h2>
</template>
应用程序.js
require('./bootstrap');

import Vue from 'vue';

import { InertiaApp } from '@inertiajs/inertia-vue';
import { InertiaForm } from 'laravel-jetstream';
import PortalVue from 'portal-vue';

Vue.use(InertiaApp);
Vue.use(InertiaForm);
Vue.use(PortalVue);

const app = document.getElementById('app');

new Vue({
render: (h) =>
h(InertiaApp, {
props: {
initialPage: JSON.parse(app.dataset.page),
resolveComponent: (name) => require(`./Pages/${name}`).default,
},
}),
}).$mount(app);
知道为什么找不到 Test.vue 模板吗?

最佳答案

也许其他人像我一样来到这里 - 我不得不在 Chrome 中打开开发者控制台并确保在 Network 中。标签,我有 disable cache检查。
最重要的是,必须进入我的服务器并执行 php artisan optimize清除缓存的 View 。

关于Laravel 8 (Inertia js) - 获取 Vue 错误 'app.js:30559 [Vue warn]: Error in created hook: "错误 : Cannot find module. ..',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63990206/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com