簡體   English   中英

Laravel 8、Jetstream、慣性:在 DOM 中尋找應用

[英]Laravel 8, Jetstream, inertia: Looking for app in the DOM

好的,嘗試將我們的 Vuetify 應用程序移至 L8、Jetstream 和慣性堆棧。 我在 ./resources/js/app.js 中看到這一行

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

它正在獲取 DOM 中的 app 元素。
我的問題是 --- 是什么定義了應用程序。

在我的 L7 應用程序中,它在單個 Blade.php 中定義

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
    <div id="app"></div>
    <script src="{{ asset('js/app.js') }}" defer></script>
</body>

我在 L8 中找不到它,這得到了這個......

initialPage: JSON.parse(app.dataset.page),

[Vue warn]: Error in render: "SyntaxError: Unexpected token u in JSON at position 0"

謝謝,吉姆在佛羅里達

它由慣性$rootView定義

file: Middleware/HandleInertiaRequests.php

...
protected $rootView = 'app';

其中,“應用程序”的意思app.blade.php視圖文件夾內,你應該有@inertia指令

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM