article-comment.vue 884 Bytes
<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>