Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

david19's avatar

Laravel Components and Vue.js

Hello Team. I have a question for a approach.

Example: Lets create a dropdown Button Component.

I will create a Laravel Component. But now i need javascript for my dropdown button.

Where is the best place for my vuejs? Because, if i use this button many times in the same page, then i get the same javascript code again.

Should i create Vue Component,too for this button? My Code works, but its not clean...Many thanks.

0 likes
5 replies
JoaoPedroAlves's avatar

I think the answer is very simple. Creating a Vue Component is a perfect solution for what you're trying to achieve. Just create a Vue Component and re-use it throught your Laravel project.

1 like
david19's avatar

@joaopedroalves Thanks for your answere. The problem is "SEO".

Google can not read this:

<vue-component></vue-component>

This is why i love the PHP Components with Laravel.

walidabou's avatar

This is just a button and there is no problem with it. It doesn't affect the SEO

1 like
david19's avatar

@walidabou Thanks for your answere.

All dropdown Buttons have a menu, or other content. If you have a dropdown button in your navbar, then google will not render the menu items inside the button. I like find a good way between this problem.

david19's avatar

I found Apline JS. I think this is the best solution. Because its created for serverside rendering apps ( Laravel ).

Please or to participate in this conversation.