[Vuejs]-Vue data not updated but data changes

2👍

You’re using an anonymous function.
this inside the anonymous function does not provide the component’s context.

Try using an arrow function instead:

EventBus.$on('HTML', (payLoad) => {
      this.embedData = payLoad
      console.log('payLoad:' + this.embedData);
    });
👤Mythos

1👍

Mythos found the issue (at least one of them). The mustache template (double curly braces) interpret contents as plain text, not html. If you want to inject raw html into your page you should do something like

<div v-html="embedData"></div>

instead (https://v2.vuejs.org/v2/guide/syntax.html#Raw-HTML)

Leave a comment