...
|
...
|
@@ -2,8 +2,8 @@ |
|
|
<div class="article-item-intro">
|
|
|
<div ref="intro" v-if="intro" class="intro hover-opacity" :class="introClass" :style="introStyle" @click="onExpand">
|
|
|
{{intro}}
|
|
|
<span class="expand" v-if="!isExpand && isEllipsis">…展开</span>
|
|
|
<span class="expand collapse" v-if="isExpand && isEllipsis">收起</span>
|
|
|
<span class="expand" v-if="showExpand">…展开</span>
|
|
|
<span class="expand collapse" v-if="showCollapse">收起</span>
|
|
|
</div>
|
|
|
<div class="topics">
|
|
|
<WidgetTopic
|
...
|
...
|
@@ -20,7 +20,7 @@ |
|
|
<div class="opts">
|
|
|
<WidgetFav :num="data.praiseCount" :article-id="data.articleId" :option="praiseOption"></WidgetFav>
|
|
|
<WidgetLike :num="data.favoriteCount" :article-id="data.articleId" :option="favoriteOption"></WidgetLike>
|
|
|
<WidgetComment :num="data.commentCount" @click.native="onComment"></WidgetComment>
|
|
|
<WidgetComment :num="data.commentCount" @click.native="onShowComment"></WidgetComment>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -41,19 +41,22 @@ export default { |
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
isEllipsis: true,
|
|
|
isExpand: false,
|
|
|
isExpanding: false,
|
|
|
introCollapseHeight: 0,
|
|
|
introHeight: 0
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
if (this.data.intro.length < 66) {
|
|
|
this.isEllipsis = false;
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
showExpand() {
|
|
|
return (!this.isExpand && this.isEllipsis) || this.data.articleType === 2;
|
|
|
},
|
|
|
showCollapse() {
|
|
|
return this.isExpand && this.isEllipsis;
|
|
|
},
|
|
|
isEllipsis() {
|
|
|
return this.data.intro.length >= 66;
|
|
|
},
|
|
|
intro() {
|
|
|
if (this.isExpand || this.data.intro.length < 66) {
|
|
|
return this.data.intro;
|
...
|
...
|
@@ -64,6 +67,7 @@ export default { |
|
|
introClass() {
|
|
|
return {
|
|
|
'intro-expand': this.isExpand,
|
|
|
'no-more': !this.isEllipsis
|
|
|
};
|
|
|
},
|
|
|
introStyle() {
|
...
|
...
|
@@ -101,14 +105,14 @@ export default { |
|
|
this.$yoho.share({
|
|
|
title: '逛资讯',
|
|
|
imgUrl: this.data.imageUrl,
|
|
|
link: `http://yoho-community-web.test3.ingress.dev.yohocorp.com/article/${this.data.articleId}`,
|
|
|
link: `http://yoho-community-web.test3.ingress.dev.yohocorp.com/article/${this.data.articleId}?isShare=1`,
|
|
|
desc: this.data.intro,
|
|
|
hideType: ['7', '8', '9']
|
|
|
});
|
|
|
},
|
|
|
onExpand() {
|
|
|
if (this.data.articleType === 2) {
|
|
|
this.$emit('on-expand');
|
|
|
return;
|
|
|
return this.$emit('on-expand');
|
|
|
}
|
|
|
if (!this.isEllipsis) {
|
|
|
return;
|
...
|
...
|
@@ -128,8 +132,10 @@ export default { |
|
|
resizeScroll() {
|
|
|
this.$emit('on-resize');
|
|
|
},
|
|
|
onComment() {
|
|
|
this.$emit('on-comment');
|
|
|
onShowComment() {
|
|
|
if (this.data.commentCount) {
|
|
|
this.$emit('on-show-comment');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
@@ -160,6 +166,10 @@ export default { |
|
|
padding-bottom: 40px;
|
|
|
// overflow-y: auto;
|
|
|
}
|
|
|
|
|
|
&.no-more {
|
|
|
height: auto;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.expand {
|
...
|
...
|
|