Use this if:
- You just want a few interactive pieces here and there and you're still rendering everything from the Rails views
- Your Rails frontend isn't a single-page VueJS application
Note: This works if your app has a rails/webpacker
and VueJS
installed
In your views:
= vue_component component_name: "my-component", props: { hello: "world" }
In your webpacker app/javascripts/packs/application.js
import MyComponent from "../components/MyComponent"
import VueMounter from "../services/VueMounter"
let mounter = new VueMounter()
mounter.setWatchList({
"my-components": MyComponent,
})
mounter.mountComponents()