Skip to content
Advertisement

How can I use Blade in Vue files?

I’m trying to use Blade in my Vue file carousel-signUp.vue

Like:

JavaScript

But in the end I’m getting an error.

The compiler can’t understand the difference between Vue syntax and Blade syntax. How can I define Blade syntax in Vue files?

Or, does anyone have an idea how to use {{route('dump')}} value in my vue file?

Advertisement

Answer

A better solution might be to output the desired blade variables to (hidden) html and select that html in your Vue code. Escape the curly braces for Vue with @.

Your blade example.blade.php

JavaScript

The result of that blade (how it will look in the cached file) + javascript (Vue)

JavaScript
JavaScript

I found a post having the same issue as you

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement