Search code examples
laravellaravel-5vue.jsvuejs2laravel-5.5

Using Laravel includes inside a vue component?


I have a set of components, some components include other components via @include('my-sub-component')

The issue is that when I want to use vue I have to put the entire component in the vue.js file inside the template tags.

But inside the template I want to use the @include so I can include some sub components. This does not work.

How can I include blade components inside a vue component?


Solution

  • As far as I know, it's impossible. You can't use PHP (Laravel Blade) .blade.php tags inside Vue Component .js, of course Vue can't execute PHP script in this case. The possible use case is you use the Vue Component inside Laravel Blade.