miaolz123 / vue-markdown

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

VueMarkdown doesn't load new data when I navigate inside one component #24

Closed aika-ssha closed 7 years ago

aika-ssha commented 7 years ago

Hello everyone!

I use vue-markdown component and inside it {{ news.text }}. When I navigate from News.vue to ExactNews.vue it's component destroyed and rendered again. When I navigate inside 1 component ExactNews.vue (next and previous news) component not destroyed and vue-markdown save old data (inside Vue tool in browser I see old data in sourceData -> in VueMarkdown component and inside event -> payload (old data) emitted by VueMarkdown)

How can I solve this problem???

miaolz123 commented 7 years ago

You can set souce of vue-markdown use v-bind.

<vue-markdown v-bind:source="mydata"></vue-markdown>

navigate to news1:

mydata = news1.test;

navigate to news2:

mydata = news2.test;
drbarto commented 5 years ago

@miaolz123 I ran into the same issue and solved it by using source. But I also would like to understand this issue. Do you have this explained somewhere in the docs? If not, would you be so kind and give a short summary of the technical reasons here?