Skip to content

Commit a1afcd2

Browse files
committed
Merge branch 'dev' of https://github.com/dcloudio/hello-uniapp into dev
2 parents 984e41f + 2e4b173 commit a1afcd2

1 file changed

Lines changed: 167 additions & 178 deletions

File tree

‎components/tab-nvue/mediaList.vue‎

Lines changed: 167 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -1,186 +1,175 @@
11
<template>
2-
<view>
3-
<view class="list-cell" hover-class="uni-list-cell-hover" @click="bindClick">
4-
<view class="media-list" v-if="options.title">
5-
<view :class="[isImgRight?'media-image-right':'',isImgLeft?'media-image-left':'']">
6-
<text :class="['media-title',isImgRight||isImgLeft?'media-title2':'']">{{options.title}}</text>
7-
<view v-if="showImg" :class="['image-section',isImgRight?'image-section-right':'',isImgLeft?'image-section-left':'']">
8-
<image :class="['image-list1',isImgRight||isImgLeft?'image-list2':'']" v-if="options.image_url"
9-
:src="options.image_url"></image>
10-
<image class="image-list3" v-if="options.image_list" :src="source.url" v-for="(source, i) in options.image_list"
11-
:key="i" />
12-
</view>
13-
</view>
14-
<view class="media-foot">
15-
<view class="media-info">
16-
<text class="info-text">{{options.source}}</text>
17-
<text class="info-text">{{options.comment_count}}条评论</text>
18-
<text class="info-text">{{options.datetime}}</text>
19-
</view>
20-
<view class="max-close-view" @click.stop="close">
21-
<view class="close-view"><text class="close">×</text></view>
22-
</view>
23-
</view>
24-
</view>
25-
</view>
26-
</view>
2+
<view>
3+
<view class="list-cell" hover-class="uni-list-cell-hover" @click="bindClick">
4+
<view class="media-list" v-if="options.title">
5+
<view :class="{'media-image-right': options.article_type === 2, 'media-image-left': options.article_type === 1}">
6+
<text class="media-title" :class="{'media-title2': options.article_type === 1 || options.article_type === 2}">{{options.title}}</text>
7+
<view v-if="options.image_list || options.image_url" class="image-section" :class="{'image-section-right': options.article_type === 2, 'image-section-left': options.article_type === 1}">
8+
<image class="image-list1" :class="{'image-list2': options.article_type === 1 || options.article_type === 2}"
9+
v-if="options.image_url" :src="options.image_url"></image>
10+
<image class="image-list3" v-if="options.image_list" :src="source.url" v-for="(source, i) in options.image_list"
11+
:key="i" />
12+
</view>
13+
</view>
14+
<view class="media-foot">
15+
<view class="media-info">
16+
<text class="info-text">{{options.source}}</text>
17+
<text class="info-text">{{options.comment_count}}条评论</text>
18+
<text class="info-text">{{options.datetime}}</text>
19+
</view>
20+
<view class="max-close-view" @click.stop="close">
21+
<view class="close-view"><text class="close">×</text></view>
22+
</view>
23+
</view>
24+
</view>
25+
</view>
26+
</view>
2727
</template>
2828

2929
<script>
30-
export default {
31-
props: {
32-
options: {
33-
type: Object,
34-
default: function(e) {
35-
return {}
36-
}
37-
}
38-
},
39-
computed: {
40-
isImgRight() {
41-
return this.options.article_type === 2
42-
},
43-
isImgLeft() {
44-
return this.options.article_type === 1
45-
},
46-
showImg() {
47-
return this.options.image_list || this.options.image_url
48-
}
49-
},
50-
methods: {
51-
close(e) {
52-
this.$emit('close');
53-
},
54-
bindClick() {
55-
this.$emit('click');
56-
}
57-
}
58-
}
30+
export default {
31+
props: {
32+
options: {
33+
type: Object,
34+
default: function(e) {
35+
return {}
36+
}
37+
}
38+
},
39+
methods: {
40+
close(e) {
41+
this.$emit('close');
42+
},
43+
bindClick() {
44+
this.$emit('click');
45+
}
46+
}
47+
}
5948
</script>
6049

6150
<style>
62-
view {
63-
display: flex;
64-
flex-direction: column;
65-
box-sizing: border-box;
66-
}
67-
68-
.list-cell {
69-
width: 750upx;
70-
padding: 0 30upx;
71-
}
72-
73-
.uni-list-cell-hover {
74-
background-color: #eeeeee;
75-
}
76-
77-
.media-list {
78-
flex: 1;
79-
flex-direction: column;
80-
border-bottom-width: 1upx;
81-
border-bottom-style: solid;
82-
border-bottom-color: #c8c7cc;
83-
padding: 20upx 0;
84-
}
85-
86-
.media-image-right {
87-
flex-direction: row;
88-
}
89-
90-
.media-image-left {
91-
flex-direction: row-reverse;
92-
}
93-
94-
.media-title {
95-
flex: 1;
96-
}
97-
98-
.media-title {
99-
lines: 3;
100-
text-overflow: ellipsis;
101-
font-size: 32upx;
102-
color: #555555;
103-
}
104-
105-
.media-title2 {
106-
flex: 1;
107-
margin-top: 6upx;
108-
line-height: 40upx;
109-
}
110-
111-
.image-section {
112-
margin-top: 20upx;
113-
flex-direction: row;
114-
justify-content: space-between;
115-
}
116-
117-
.image-section-right {
118-
margin-top: 0upx;
119-
margin-left: 10upx;
120-
width: 225upx;
121-
height: 146upx;
122-
}
123-
124-
.image-section-left {
125-
margin-top: 0upx;
126-
margin-right: 10upx;
127-
width: 225upx;
128-
height: 146upx;
129-
}
130-
131-
.image-list1 {
132-
width: 690upx;
133-
height: 481upx;
134-
}
135-
136-
.image-list2 {
137-
width: 225upx;
138-
height: 146upx;
139-
}
140-
141-
.image-list3 {
142-
width: 225upx;
143-
height: 146upx;
144-
}
145-
146-
.media-info {
147-
flex-direction: row;
148-
}
149-
150-
.info-text {
151-
margin-right: 20upx;
152-
color: #999999;
153-
font-size: 24upx;
154-
}
155-
156-
.media-foot {
157-
margin-top: 20upx;
158-
flex-direction: row;
159-
justify-content: space-between;
160-
}
161-
162-
.max-close-view {
163-
align-items: center;
164-
justify-content: flex-end;
165-
flex-direction: row;
166-
height: 40upx;
167-
width: 80upx;
168-
}
169-
170-
.close-view {
171-
border-style: solid;
172-
border-width: 1px;
173-
border-color: #999999;
174-
border-radius: 10upx;
175-
justify-content: center;
176-
height: 30upx;
177-
width: 40upx;
178-
line-height: 30upx;
179-
}
180-
181-
.close {
182-
text-align: center;
183-
color: #999999;
184-
font-size: 28upx;
185-
}
51+
view {
52+
display: flex;
53+
flex-direction: column;
54+
box-sizing: border-box;
55+
}
56+
57+
.list-cell {
58+
width: 750upx;
59+
padding: 0 30upx;
60+
}
61+
62+
.uni-list-cell-hover {
63+
background-color: #eeeeee;
64+
}
65+
66+
.media-list {
67+
flex: 1;
68+
flex-direction: column;
69+
border-bottom-width: 1upx;
70+
border-bottom-style: solid;
71+
border-bottom-color: #c8c7cc;
72+
padding: 20upx 0;
73+
}
74+
75+
.media-image-right {
76+
flex-direction: row;
77+
}
78+
79+
.media-image-left {
80+
flex-direction: row-reverse;
81+
}
82+
83+
.media-title {
84+
flex: 1;
85+
}
86+
87+
.media-title {
88+
lines: 3;
89+
text-overflow: ellipsis;
90+
font-size: 32upx;
91+
color: #555555;
92+
}
93+
94+
.media-title2 {
95+
flex: 1;
96+
margin-top: 6upx;
97+
line-height: 40upx;
98+
}
99+
100+
.image-section {
101+
margin-top: 20upx;
102+
flex-direction: row;
103+
justify-content: space-between;
104+
}
105+
106+
.image-section-right {
107+
margin-top: 0upx;
108+
margin-left: 10upx;
109+
width: 225upx;
110+
height: 146upx;
111+
}
112+
113+
.image-section-left {
114+
margin-top: 0upx;
115+
margin-right: 10upx;
116+
width: 225upx;
117+
height: 146upx;
118+
}
119+
120+
.image-list1 {
121+
width: 690upx;
122+
height: 481upx;
123+
}
124+
125+
.image-list2 {
126+
width: 225upx;
127+
height: 146upx;
128+
}
129+
130+
.image-list3 {
131+
width: 225upx;
132+
height: 146upx;
133+
}
134+
135+
.media-info {
136+
flex-direction: row;
137+
}
138+
139+
.info-text {
140+
margin-right: 20upx;
141+
color: #999999;
142+
font-size: 24upx;
143+
}
144+
145+
.media-foot {
146+
margin-top: 20upx;
147+
flex-direction: row;
148+
justify-content: space-between;
149+
}
150+
151+
.max-close-view {
152+
align-items: center;
153+
justify-content: flex-end;
154+
flex-direction: row;
155+
height: 40upx;
156+
width: 80upx;
157+
}
158+
159+
.close-view {
160+
border-style: solid;
161+
border-width: 1px;
162+
border-color: #999999;
163+
border-radius: 10upx;
164+
justify-content: center;
165+
height: 30upx;
166+
width: 40upx;
167+
line-height: 30upx;
168+
}
169+
170+
.close {
171+
text-align: center;
172+
color: #999999;
173+
font-size: 28upx;
174+
}
186175
</style>

0 commit comments

Comments
 (0)