article-detail-share.vue 827 Bytes
<template>
  <ArticleDetail :share="true" :set-share-data="setShareData"></ArticleDetail>
</template>

<script>
import Share from 'plugins/share';
import {getDetailShareData} from 'utils/share-handler';
import ArticleDetail from './article-detail';

export default {
  name: 'ArticleDetailShare',
  mounted() {
    if (!this.$yoho.isApp) {
      Share.init();
    }
  },
  methods: {
    setShareData(article) {
      if (!article) {
        return;
      }

      let shareData = getDetailShareData(article, this.$yoho.appVersion);

      document && (document.title = shareData.title);

      if (!this.$yoho.isApp) {
        Share.setShareInfo(shareData);
      }
    }
  },
  components: {
    ArticleDetail
  }
};
</script>

<style lang="scss" scoped>
/deep/ {
  .article-detail-header {
    display: none;
  }
}
</style>