3 years ago

Possible to pass vuejs variable into @include('partial') as blade variable

Posted 3 years ago by EventFellows

I have a simple view that uses vuejs. There I have a varialbe available event that I need to pass on to a partial (which also get's used from other views that do no use vuejs.

In the view I can do everything you would expect like:

<h1>@{{ event.title }}</h1>
<p>@{{ event.description}}</p>

In a normal blade-only setup i would simply do this:

@include('partials.users.event-actions', ['event' => $event)

But if I try to pass the vuejs event-variable to a partial, it won't work:

@include('partials.users.event-actions', ['event' => @{{ event }})  <!-- this cannot work but it should illustrate what I try to do -->

Is there way to pass on the vue variable (without re-writing the partial to also use vuejs directly)?

Please sign in or create an account to participate in this conversation.