# 开发文章详情页信息组件
detail.vue
<template>
<view class="common-list animated fadeInLeft fast">
<!-- 左边头像 -->
<view class="common-list-l">
<image :src="item.userpic" mode="widthFix" lazy-load></image>
</view>
<!-- 右边内容 -->
<view class="common-list-r">
<!-- 作者 -->
<view class="author-area">
<view>{{item.username}}
<tagSexAge :sex="item.sex" :age="item.age"></tagSexAge>
</view>
<view class="icon iconfont icon-zengjia guanzhu" v-if="!isguanzhu" @tap="guanzhu">关注</view>
</view>
<view class="common-list-r-time">26天前</view>
<!-- 标题 -->
<view class="title-area">{{item.title}}</view>
<!-- 图片 -->
<view class="image-area u-f-ajc" style="flex-direction: column;">
<!-- 图片 -->
<block v-for="(pic, index) in item.morepic" :key="index">
<image style="margin-bottom: 15rpx;" :src="pic" mode="widthFix" lazy-load @tap="imgdetail(index)"></image>
</block>
<!-- 视频 -->
<template v-if="item.video">
<view class="common-list-play icon iconfont icon-bofang">
</view>
<view class="common-list-playinfo">{{item.video.loopnum}} 次播放 {{item.video.long}}</view>
</template>
<!-- 分享 -->
<view class="common-list-share u-f" v-if="item.share">
<image :src="item.share.titlepic" mode="widthFix" lazy-load></image>
<view>{{item.share.title}}</view>
</view>
</view>
<!-- 其它信息 -->
<view class="address-area">
<view>{{item.path}}</view>
<view>
<view class="icon iconfont icon-zhuanfa">{{item.sharenum}}</view>
<view class="icon iconfont icon-pinglun1">{{item.commentnum}}</view>
<view class="icon iconfont icon-dianzan1">{{item.goodnum}}</view>
</view>
</view>
</view>
</view>
</template>
<script>
import tagSexAge from '../common/tag-sex-age.vue'
export default {
components: {
tagSexAge
},
props: {
item: Object
},
data() {
return {
isguanzhu: this.item.isguanzhu
}
},
methods: {
guanzhu() {
this.isguanzhu = true
uni.showToast({
title: '关注成功'
})
},
// 图片预览
imgdetail(index) {
uni.previewImage({
current:index,
urls:this.item.morepic
})
}
}
}
</script>
<style lang="less" scoped>
@import '../../common/list.less';
.common-list {
border-bottom: 1rpx solid #eee;
.common-list-r {
border-bottom: 0;
.common-list-r-time {
color: #ccc;
font-size: 26rpx;
}
}
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96