[Vuejs]-Vuejs component inside legacy rails modal

0👍

I expected an event to fire. Something like turbolinks:load. But this is an XHR-Request where this kind of stuff doesnt happen.

From:

document.addEventListener(turbolinks:load => ({
  const productAsset = new Vue({
    el: '#product_asset_form',
    store,
    railsI18n,
    productAssetRoutes,
    render: h => h(ProductAsset, { props: { ...root_element.dataset } }),
  }).$mount()
)}

To:

const productAsset = new Vue({
  el: '#product_asset_form',
  store,
  // this is vue-i18n magic...
  i18n: railsI18n,
  productAssetRoutes,
  render: h => h(ProductAsset, { props: { ...root_element.dataset } }),
}).$mount()

And now it fires immediatly

Leave a comment