article-comment.vue
884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<template>
<Comment ref="comment" :dest-id="articleId" :pos-id="sceneId" :articleId="articleId"></Comment>
</template>
<script>
import YAS from 'utils/yas-constants';
export default {
name: 'ArticleComment',
data() {
return {
size: 0,
articleId: 0,
sceneId: YAS.scene.newsDetail
};
},
mounted() {
this.articleId = +this.$route.params.articleId;
this.init();
},
activated() {
if (+this.$route.params.articleId !== this.articleId) {
this.articleId = +this.$route.params.articleId;
this.init();
}
},
beforeRouteUpdate(to, from, next) {
if (+this.$route.params.articleId !== +to.params.articleId) {
this.articleId = +to.params.articleId;
this.init();
}
next();
},
methods: {
init() {
this.$nextTick(() => {
this.$refs.comment.init();
});
}
}
};
</script>