[Vuejs]-Unable to trigger render when switching between multiple objects containing content in different languages

0👍

Did you try doing deep copy:

switchToGerman () {
  const copyContent = JSON.parse(JSON.stringify(this.mainContent))
  copyContent.content = contentDe
  this.mainContent = copyContent
}

0👍

I found the solution (thank you @EricGuan for pointing out that the mistake must lay somewhere else)

As you can see in the original post I created a watcher for the mainData property and expected that this would trigger the re render.

What was missing is, that I didn’t watch the content property on the ProjectElement component, thus not triggering a re render there.

I added this to ProjectElement.vue and now it works like a charm:

    watch: {
        content(newContent){
            this.projectContent = newContent
        }
    },

Thank you everybody for helping me! <3

Leave a comment