Skip to content

Commit

Permalink
fix: render vue components in theme editor section
Browse files Browse the repository at this point in the history
  • Loading branch information
sergejcodes committed Apr 17, 2021
1 parent ef8d8cc commit 98d7cd7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,23 @@ Vue.prototype.$axios = axios
new Vue({
el: '#app',
store
})

/**
* fix: properly render vue components inside sections on user insert in the theme editor
* add the 'vue' keyword to the section's wrapper classes e.g.:
* {% schema %}
* {
* "class": "shopify-section-vue"
* }
* {% endschema %}
*/
// eslint-disable-next-line
Shopify.designMode && document.addEventListener('shopify:section:load', (event) => {
if(event.target.classList.value.includes('vue')) {
new Vue({
el: event.target,
store
})
}
})

0 comments on commit 98d7cd7

Please sign in to comment.