Skip to content

Using Vue components for Theme Sections and updating via the Theme Editor fails. #69

Answered by sergejcodes
sebszocinski asked this question in Q&A
Discussion options

You must be logged in to vote

Without additional info, I assume your Vue component isn't being compiled and rendered by Vue after you insert a section in the theme editor.

Shopify does fire some events based on user selection, see here

For some reason, I couldn't get the root Vue instance to update. As a workaround append this to your main.js file to force-create a new Vue component in the theme editor, when selecting/inserting a section:

// eslint-disable-next-line
if (Shopify && Shopify.designMode) {
  document.addEventListener('shopify:section:load', (event) => {
    new Vue({
      el: event.target,
      store
    })
  })
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sebszocinski
Comment options

@sebszocinski
Comment options

Answer selected by sebszocinski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants