Just figured out how to resolve this issue. Simply bind the data using v-html
<div id="app">
<h1 v-html="equation"></h1>
<button @click='change'>Change</button>
</div>
var vm = new Vue({
el: '#app',
data: function() {
return {
equation: '`result`'
}
},
methods : {
change : function() {
this.equation = '`x '+Math.floor((Math.random() * 10) + 1)+'`';
this.$nextTick(function() {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
});
}
}
})
Why is the element duplicating when I update the data? Any idea on how to update MathJax with vuejs 2?
Check out my app here: Image
var vm = new Vue({
el: '#app',
data: function() {
return {
equation: 'result'
}
},
methods : {
change : function() {
this.equation = 'result_'+Math.floor((Math.random() * 10) + 1);
this.$nextTick(function() {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
});
}
}
})