pass php parameters to vue function inside bladee


In my blade view.

@foreach($r_templates as $key => $rt)
    <button @click="someFunc({{$rt['title'}})">click me</button>
@endforeach

// In my vue script
someFunc(title) { console.log(title); }

the above code seems to not work and it does not have errors too.

but when I change the parameter to 'something', it works.

How do I pass a PHP variable to a vue function?

Source: Vue – Stack Overflow

November 23, 2021
Category : News
Tags: laravel | laravel-blade | Vue.js

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.