Created
April 4, 2017 17:58
-
-
Save excid3/3fd127f0db92374b6948b68cfcfc566d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('turbolinks:load', () => { | |
var element = document.getElementById("hello") | |
var cachedHtml = element.outerHTML | |
var vueapp = new Vue({ | |
el: element, | |
template: '<App/>', | |
components: { App }, | |
destroyed: function() { | |
this.$el.outerHTML = cachedHtml; | |
} | |
}) | |
document.addEventListener('turbolinks:before-cache', () => { | |
vueapp.$destroy() | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment