Vue.js Components in Rails Views Discussion
Discussion for
Vue.js Components in Rails Views
Guys, I feel very stupid asking this but I still don't understand what is the purpose of data-behavior="vue"
to initialize the Vue instance. How does this differ compared to doing <div id="app"><%= yield %></div>
? It feels like the serve exactly the same purpose.
This looks like Rails UJS born-again: add in a simple html attribute and BOOM: you get all this functionality for free with minimal effort. I would also add that if this approach is combined with a stimulus controller: and you can load and initialize vue components via AJAX, or turbo_frames, or even turbo streams. best bit.