|
1 | 1 | <template> |
2 | | - <view class="uni-card uni-border" :class="{ 'uni-card--full': isFull === true || isFull === 'true', 'uni-card--shadow': isShadow === true || isShadow === 'true'}"> |
| 2 | + <view class="uni-card uni-border" |
| 3 | + :class="{ 'uni-card--full': isFull === true || isFull === 'true', 'uni-card--shadow': isShadow === true || isShadow === 'true'}"> |
3 | 4 | <!-- 基础 --> |
4 | | - <view v-if="mode === 'basic' && title" class="uni-card__header uni-border-bottom" @click.stop="onClick"> |
5 | | - <view v-if="thumbnail" class="uni-card__header-extra-img-view"> |
6 | | - <image :src="thumbnail" class="uni-card__header-extra-img" /> |
| 5 | + <view v-if="mode === 'basic' && title" @click.stop="onClick" class="uni-card__head-padding"> |
| 6 | + <view class="uni-card__header uni-border-bottom"> |
| 7 | + <slot name="header"> |
| 8 | + <view v-if="thumbnail" class="uni-card__header-extra-img-view"> |
| 9 | + <image :src="thumbnail" class="uni-card__header-extra-img" /> |
| 10 | + </view> |
| 11 | + <text class="uni-card__header-title-text">{{ title }}</text> |
| 12 | + <text v-if="extra" class="uni-card__header-extra-text">{{ extra }}</text> |
| 13 | + </slot> |
7 | 14 | </view> |
8 | | - <text class="uni-card__header-title-text">{{ title }}</text> |
9 | | - <text v-if="extra" class="uni-card__header-extra-text">{{ extra }}</text> |
10 | 15 | </view> |
11 | 16 | <!-- 标题 --> |
12 | | - <view v-if="mode === 'title'" class="uni-card__title uni-border-bottom" @click.stop="onClick"> |
13 | | - <view class="uni-card__title-box"> |
14 | | - <view class="uni-card__title-header"> |
15 | | - <image class="uni-card__title-header-image" :src="thumbnail" mode="scaleToFill" /> |
16 | | - </view> |
17 | | - <view class="uni-card__title-content"> |
18 | | - <text class="uni-card__title-content-title uni-ellipsis">{{ title }}</text> |
19 | | - <text class="uni-card__title-content-extra uni-ellipsis">{{ subTitle }}</text> |
20 | | - </view> |
21 | | - </view> |
22 | | - <view v-if="extra"> |
23 | | - <text class="uni-card__header-extra-text">{{ extra }}</text> |
| 17 | + <view v-if="mode === 'title'" @click.stop="onClick" class="uni-card__head-padding"> |
| 18 | + <view class="uni-card__title uni-border-bottom"> |
| 19 | + <slot name="header"> |
| 20 | + <view class="uni-card__title-box"> |
| 21 | + <view v-if="thumbnail" class="uni-card__title-header"> |
| 22 | + <image class="uni-card__title-header-image" :src="thumbnail" mode="scaleToFill" /> |
| 23 | + </view> |
| 24 | + <view class="uni-card__title-content"> |
| 25 | + <text class="uni-card__title-content-title uni-ellipsis">{{ title }}</text> |
| 26 | + <text class="uni-card__title-content-extra uni-ellipsis">{{ subTitle }}</text> |
| 27 | + </view> |
| 28 | + </view> |
| 29 | + <view v-if="extra"> |
| 30 | + <text class="uni-card__header-extra-text">{{ extra }}</text> |
| 31 | + </view> |
| 32 | + </slot> |
24 | 33 | </view> |
25 | 34 | </view> |
26 | 35 | <!-- 图文 --> |
27 | 36 | <view v-if="mode === 'style'" class="uni-card__thumbnailimage" @click.stop="onClick"> |
28 | 37 | <view class="uni-card__thumbnailimage-box"> |
29 | | - <image class="uni-card__thumbnailimage-image" :src="thumbnail" mode="aspectFill" /> |
| 38 | + <image v-if="thumbnail" class="uni-card__thumbnailimage-image" :src="thumbnail" mode="aspectFill" /> |
| 39 | + <uni-icons v-if="!thumbnail" type="image" size="30" color="#999" /> |
| 40 | + </view> |
| 41 | + <view v-if="title" class="uni-card__thumbnailimage-title"> |
| 42 | + <text class="uni-card__thumbnailimage-title-text">{{ title }}</text> |
30 | 43 | </view> |
31 | | - <view v-if="title" class="uni-card__thumbnailimage-title"><text class="uni-card__thumbnailimage-title-text">{{ title }}</text></view> |
32 | 44 | </view> |
33 | 45 | <!-- 内容 --> |
34 | 46 | <view class="uni-card__content uni-card__content--pd" @click.stop="onClick"> |
35 | | - <view v-if="mode === 'style' && extra" class=""><text class="uni-card__content-extra">{{ extra }}</text></view> |
| 47 | + <view v-if="mode === 'style' && extra" class=""><text class="uni-card__content-extra">{{ extra }}</text> |
| 48 | + </view> |
36 | 49 | <slot /> |
37 | 50 | </view> |
38 | 51 | <!-- 底部 --> |
|
52 | 65 | * @property {String} title 标题文字 |
53 | 66 | * @property {String} subTitle 副标题(仅仅mode=title下生效) |
54 | 67 | * @property {String} extra 标题额外信息 |
55 | | - * @property {String} note 标题左侧缩略图 |
56 | | - * @property {String} thumbnail 底部信息 |
| 68 | + * @property {String} note 底部信息 |
| 69 | + * @property {String} thumbnail 标题左侧缩略图 |
57 | 70 | * @property {String} mode = [basic|style|title] 卡片模式 |
58 | 71 | * @value basic 基础卡片 |
59 | 72 | * @value style 图文卡片 |
|
121 | 134 | position: relative; |
122 | 135 | flex-direction: column; |
123 | 136 | border-radius: 5px; |
124 | | - overflow: hidden; |
125 | | - /* #ifdef H5 */ |
126 | | - cursor: pointer; |
| 137 | + overflow: hidden; |
| 138 | + /* #ifdef H5 */ |
| 139 | + cursor: pointer; |
127 | 140 | /* #endif */ |
128 | 141 | } |
129 | 142 |
|
|
217 | 230 | /* #endif */ |
218 | 231 |
|
219 | 232 | .uni-card__thumbnailimage { |
220 | | - position: relative; |
| 233 | + position: relative; |
| 234 | + /* #ifndef APP-NVUE */ |
| 235 | + // display: flex; |
| 236 | + /* #endif */ |
221 | 237 | flex-direction: column; |
222 | | - justify-content: center; |
223 | | - height: 150px; |
| 238 | + justify-content: center; |
| 239 | + height: 150px; |
| 240 | + background-color: #F1F1F1; |
224 | 241 | overflow: hidden; |
225 | 242 | } |
226 | 243 |
|
227 | 244 | .uni-card__thumbnailimage-box { |
228 | 245 | /* #ifndef APP-NVUE */ |
229 | 246 | display: flex; |
230 | 247 | /* #endif */ |
231 | | - flex: 1; |
232 | | - flex-direction: row; |
233 | | - overflow: hidden; |
| 248 | + flex: 1; |
| 249 | + height: 150px; |
| 250 | + flex-direction: row; |
| 251 | + justify-content: center; |
| 252 | + align-items: center; |
| 253 | + overflow: hidden; |
234 | 254 | } |
235 | 255 |
|
236 | 256 | .uni-card__thumbnailimage-image { |
|
280 | 300 | width: 40px; |
281 | 301 | height: 40px; |
282 | 302 | overflow: hidden; |
283 | | - border-radius: 5px; |
| 303 | + border-radius: 5px; |
| 304 | + padding-right: 10px; |
284 | 305 | } |
285 | 306 |
|
286 | 307 | .uni-card__title-header-image { |
287 | 308 | width: 40px; |
288 | | - height: 40px; |
| 309 | + height: 40px; |
289 | 310 | } |
290 | 311 |
|
291 | 312 | .uni-card__title-content { |
|
295 | 316 | flex-direction: column; |
296 | 317 | justify-content: center; |
297 | 318 | flex: 1; |
298 | | - padding-left: 10px; |
299 | 319 | height: 40px; |
300 | 320 | overflow: hidden; |
301 | 321 | } |
|
403 | 423 | lines: 1; |
404 | 424 | /* #endif */ |
405 | 425 | } |
| 426 | +
|
| 427 | + .uni-card__head-padding { |
| 428 | + // mar: 12px; |
| 429 | + } |
406 | 430 | </style> |
0 commit comments