Authored by yyq

fix status

<template>
<ArticleDetail :share="true"></ArticleDetail>
<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);
document && (document.title = shareData.title);
console.log(shareData);
if (!this.$yoho.isApp) {
Share.setShareInfo(shareData);
}
}
},
components: {
ArticleDetail
}
... ...
... ... @@ -61,7 +61,8 @@ const {mapState, mapActions, mapMutations} = createNamespacedHelpers('article');
export default {
name: 'ArticleDetailPage',
props: {
share: Boolean
share: Boolean,
setShareData: Function
},
data() {
return {
... ... @@ -154,9 +155,13 @@ export default {
if (this.$refs.scroll) {
this.listTitle = '';
this.$nextTick(() => {
setTimeout(() => {
this.$refs.scroll.init();
});
}, 500);
}
if (this.share && this.setShareData) {
this.setShareData(get(res, 'data.detailList[0]'));
}
});
},
... ...