lib/generators/generator_templates/turbolinks/turbolinks-pack.js.erb in vuejs-1.1.0.beta3 vs lib/generators/generator_templates/turbolinks/turbolinks-pack.js.erb in vuejs-1.1.0.beta4
- old
+ new
@@ -1,21 +1,22 @@
// Generated by Vuejs gem ~> github.com/ytbryan/vuejs
-// Run this example by adding <%= '<%=' %> javascript_pack_tag "<%= name %>" <%= '%' %><%= '>' %> into your
-// rails' view
-// To generate another of this component with turbolinks, please run `rails g vue something --turbolinks`
+// Run this example by adding <%%= javascript_pack_tag "<%= name %>" %> into your
+// Rails' view
+// To generate another component part with turbolinks, please run `rails generate vue something --turbolinks`
import TurbolinksAdapter from 'vue-turbolinks';
import Vue from 'vue.esm'
-<% if options[:single] %>
-import App from '../parts/<%= name %>.vue'
-<% else %>
+<% if options['seperate'] -%>
import App from '../parts/<%= name %>/<%= name %>.vue'
-<% end %>
+<% else -%>
+import App from '../parts/<%= name %>.vue'
+<% end -%>
Vue.use(TurbolinksAdapter)
+
document.addEventListener('turbolinks:load', () => {
if(isView("###")){
- const app = new Vue({
+ const <%= name %> = new Vue({
render: h => h(App)
- }).$mount('#something')
- console.log({app})
+ }).$mount('#<%= name %>')
+ console.log({<%= name %>})
}
})
\ No newline at end of file