npm package for mounting Vue SFC as root component and pass arguments as props in Ruby on Ralis. This package should work with gem render_vue_component So please check that gem.
npm install render-vue-component
or
yarn add render-vue-component
render-vue-component
import Vue inside the package, but setup Vue outside and then pass to the package is more flexible.
get Vue currently setup in render-vue-component
use register() to register components.
import RenderVueComponent from "render-vue-component"
import ComponentA from "../components/ComponentA.vue"
import ComponentB from "../components/ComponentB.vue"
import ComponentX from "../components/ComponentX.vue"
RenderVueComponent.register({
ComponentA,
ComponentB,
...
})
By calling this method, it will search all ".vue-component" nodes, and use their data-name, data-rails-data to decide the Vue component to mount, and the props data for it.