Skip to content

Commit

Permalink
v-for should add unique key; fix Disqus same comments showing up on m…
Browse files Browse the repository at this point in the history
…ultiple pages
  • Loading branch information
fxm committed Feb 9, 2018
1 parent 120a17b commit fe42913
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/components/articles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Loading v-if="loading" />
<section class="articles-wrapper items" v-title v-show="!loading">
<ul class="articles">
<li v-for="article in articles">
<li v-for="article in articles" :key="article.ID">
<router-link :to="{ name: 'article', params: {id: article.ID} }">{{article.Title}}</router-link>
</li>
</ul>
Expand Down
5 changes: 2 additions & 3 deletions app/components/single.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
"$route": "fetchData",
},
created() {
this.page_id = `article/${this.$route.params.id}`;
this.url = window.location.href;
this.page_id = `${window.location.origin}#!${this.$route.params.id}`;
this.fetchData();
},
methods: {
Expand Down Expand Up @@ -74,7 +73,7 @@
</div>
</section>
<div class="comments" v-show="!loading">
<vue-disqus shortname="fengxiaomao" :identifier="page_id" :url="url"></vue-disqus>
<vue-disqus shortname="fengxiaomao" :identifier="page_id" :url="page_id"></vue-disqus>
</div>
<Foot v-show="!loading" />
</section>
Expand Down

0 comments on commit fe42913

Please sign in to comment.