...
|
...
|
@@ -20,15 +20,16 @@ |
|
|
<WidgetShare :share="share" @click.native="onShare"></WidgetShare>
|
|
|
</div>
|
|
|
<div class="opts">
|
|
|
<WidgetFav :share="share" :num="articleState.praiseCount" :article-id="data.articleId" :option="praiseOption"></WidgetFav>
|
|
|
<WidgetLike :share="share" :num="articleState.favoriteCount" :article-id="data.articleId" :option="favoriteOption"></WidgetLike>
|
|
|
<WidgetComment :share="share" :num="articleState.commentCount" @click.native="onShowComment"></WidgetComment>
|
|
|
<WidgetFav :class="invisibleClass" :share="share" :num="articleState.praiseCount" :article-id="data.articleId" :option="praiseOption"></WidgetFav>
|
|
|
<WidgetLike :class="invisibleClass" :share="share" :num="articleState.favoriteCount" :article-id="data.articleId" :option="favoriteOption"></WidgetLike>
|
|
|
<WidgetComment :class="invisibleClass" :share="share" :num="articleState.commentCount" @click.native="onShowComment"></WidgetComment>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {get} from 'lodash';
|
|
|
import {createNamespacedHelpers} from 'vuex';
|
|
|
const {mapMutations, mapState} = createNamespacedHelpers('article');
|
|
|
|
...
|
...
|
@@ -42,12 +43,12 @@ export default { |
|
|
}
|
|
|
},
|
|
|
type: String,
|
|
|
share: Boolean
|
|
|
share: Boolean,
|
|
|
thumb: Boolean
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
isPreExpand: false,
|
|
|
introCollapseHeight: 0,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
...
|
...
|
@@ -57,6 +58,11 @@ export default { |
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['articleStates']),
|
|
|
invisibleClass() {
|
|
|
return {
|
|
|
invisible: this.thumb
|
|
|
};
|
|
|
},
|
|
|
articleState() {
|
|
|
return this.articleStates[this.data.articleId] || this.data;
|
|
|
},
|
...
|
...
|
@@ -88,7 +94,7 @@ export default { |
|
|
if (this.data.isExpand) {
|
|
|
introHeight = this.data.introHeight;
|
|
|
} else {
|
|
|
introHeight = this.introCollapseHeight;
|
|
|
introHeight = this.data.introCollapseHeight;
|
|
|
}
|
|
|
|
|
|
return {
|
...
|
...
|
@@ -107,13 +113,11 @@ export default { |
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
if (this.$refs.intro) {
|
|
|
this.introCollapseHeight = this.$refs.intro.scrollHeight;
|
|
|
}
|
|
|
if (this.$refs.introPool) {
|
|
|
if (this.data.introHeight === 0) {
|
|
|
this.CHANGE_ARTICLE_LIST_INTRO_HEIGHT({
|
|
|
articleId: this.data.articleId,
|
|
|
introHeight: this.$refs.introPool.scrollHeight + 20,
|
|
|
introHeight: get(this.$refs, 'introPool.scrollHeight', 0) + 20,
|
|
|
introCollapseHeight: get(this.$refs, 'intro.scrollHeight', 0),
|
|
|
type: this.type
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -155,7 +159,7 @@ export default { |
|
|
return;
|
|
|
}
|
|
|
const isExpand = !this.data.isExpand;
|
|
|
const height = isExpand ? this.data.introHeight : this.introCollapseHeight;
|
|
|
const height = isExpand ? this.data.introHeight : this.data.introCollapseHeight;
|
|
|
|
|
|
this.$emit('on-expanding');
|
|
|
|
...
|
...
|
|