Closed Davidzhu001 closed 7 years ago
@Davidzhu001 Check out this in the Readme: https://github.com/jeffreyguenther/vue-turbolinks#running-vue-only-on-specific-pages
If you have a page that doesn't include the element, you don't want to initialize the Vue app on that page.
@excid3 thanks for your reply.
I found a problem of using this gem.
import Vue from 'vue/dist/vue.esm'
import Downloads from './components/downloads.vue'
import TurbolinksAdapter from 'vue-turbolinks';
document.addEventListener('turbolinks:load', () => {
var element = document.getElementById("downloads")
if (element != null) {
var downloads_vue = new Vue({
el: element,
template: '<Downloads/>',
mixins: [TurbolinksAdapter],
components: { Downloads }
});
}
else {
console.log('not found element')
}
console.log('event touched')
});
---
<div id="downloads">
</div>
<%= javascript_pack_tag 'downloads' %>
the code <%= javascript_pack_tag 'downloads' %> will called after turbolinks:loaded.
@Davidzhu001 I don't quite understand what your issue is. Can you explain it some more?
@Davidzhu001 are you still looking for assistance or can this issue be closed?
Closing b/c issue is stale.
something need to click twice for the rails link in order to show content