miaolz123 / vue-markdown

A Powerful and Highspeed Markdown Parser for Vue
https://miaolz123.github.io/vue-markdown/
MIT License
1.89k stars 257 forks source link

vue-markdown not work when use jQuery .html() reset the text in it. #40

Closed archerLj closed 6 years ago

archerLj commented 6 years ago

I want to write text with markdown format in an textArea, and then render it to another vue-markdown div. But the vue-markdown div just show the markdown format text.

this is my code:

<div class="form-group">
            <textarea v-model="qContent" class="form-control" placeholder="从这里开始写正文" id="questionContent" style="height: 300px;"></textarea>
        </div>
        <div class="markdownArea">
            <vue-markdown id="markdownReview"></vue-markdown>
        </div>
Vue.use(VueMarkdown);
var addQaOrNote = new Vue({
    el: '#addQaOrNote',
    data: {
        qTitle: '',
        qContent: '',
        input: '',
        tags: ''
    },
    watch: {
        qContent: function (val, oldVal) {
            $("#markdownReview").html(val);
        }
    }
})

does vue-markdown's text can not be reset?