Closed iwasherefirst2 closed 4 years ago
If your App.vue renders the content for the entire body, then it wouldn't be possible, just like you can't use blade inside vue files.
However, if in your example only the @yield('content')
part is rendered in SSR, then you can use blade files like normal outside of the server-side-rendered content.
Applied to your example:
layouts/app.blade.php
<html>
<head>
<title>My server side rendered app</title>
<script defer src="{{ mix('app-client.js') }}">
</head>
<body>
<div id="app">
<navigation>
<nav-item>@lang('Home')<nav-item>
<nav-item>@if(Auth::check())@lang('Dashboard')@else @lang('Login') @endif </nav-item>
<navigation>
@yield('content')
<flash message="{{ $message }}"></flash>
</div>
</body>
</html>
Then in your other blade file:
ssr.blade.php
@layout('layouts.app')
@section('content')
{!! ssr('js/app.vue') !!}
@endsection
Or just put replace @yield('content')
with {!! ssr('js/app.vue') !!}
in your original example
Dear contributor,
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.
Thank you for providing this awesome package!
I wonder, how do you server-side render when one is using both, Vue components and Blade engine?
For example, this is how my master file looks:
Since I can't put any Blade syntax into my
App.vue
nor the$message
value from the controller, I can't just useIs using Blade syntax and using values from controller still possible when using SSR?