mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[new feature] Card: update style (#1085)
This commit is contained in:
parent
5fe840ad2b
commit
41b11bc454
@ -9,6 +9,15 @@
|
||||
/>
|
||||
</demo-block>
|
||||
|
||||
<demo-block title="没有商品图片">
|
||||
<van-card
|
||||
num="2"
|
||||
price="2.00"
|
||||
desc="描述信息"
|
||||
title="商品标题"
|
||||
/>
|
||||
</demo-block>
|
||||
|
||||
<demo-block title="高级用法">
|
||||
<van-card
|
||||
num="2"
|
||||
@ -22,9 +31,9 @@
|
||||
<view slot="tags">
|
||||
<van-tag plain type="danger">满减</van-tag>
|
||||
</view>
|
||||
<view slot="footer">
|
||||
<van-button size="mini" custom-class="button">按钮</van-button>
|
||||
<van-button size="mini">按钮</van-button>
|
||||
<view slot="footer" class="van-card__footer">
|
||||
<van-button size="mini" round custom-class="button">按钮</van-button>
|
||||
<van-button size="mini" round>按钮</van-button>
|
||||
</view>
|
||||
</van-card>
|
||||
</demo-block>
|
||||
|
@ -6,3 +6,7 @@
|
||||
.button {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.van-card__footer {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
@import '../common/style/var.less';
|
||||
|
||||
.van-card {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
padding: 5px 15px;
|
||||
font-size: 12px;
|
||||
color: @text-color;
|
||||
padding: 5px 15px 5px 115px;
|
||||
background: @background-color-light;
|
||||
box-sizing: border-box;
|
||||
flex-wrap: wrap;
|
||||
|
||||
&--center {
|
||||
align-items: center;
|
||||
@ -15,11 +16,15 @@
|
||||
}
|
||||
|
||||
&__thumb {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 15px;
|
||||
position: relative;
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
margin-right: 10px;
|
||||
flex: none;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&__img {
|
||||
@ -27,49 +32,52 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&,
|
||||
&__content {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
&__content {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
height: 90px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__title,
|
||||
&__desc {
|
||||
line-height: 20px;
|
||||
line-height: 17px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
&__title {
|
||||
max-height: 40px;
|
||||
max-height: 34px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&__desc {
|
||||
max-height: 20px;
|
||||
max-height: 17px;
|
||||
color: @gray-darker;
|
||||
}
|
||||
|
||||
&__left {
|
||||
flex: 1;
|
||||
min-width: 0; // hack for flex box ellipsis
|
||||
&__bottom {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
line-height: 17px;
|
||||
}
|
||||
|
||||
&__right {
|
||||
flex: none;
|
||||
padding-left: 10px;
|
||||
line-height: 20px;
|
||||
text-align: right;
|
||||
&__price {
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
color: @red;
|
||||
}
|
||||
|
||||
&__origin-price {
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
font-size: 10px;
|
||||
color: @gray-darker;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
&__num {
|
||||
color: @gray-darker;
|
||||
float: right;
|
||||
}
|
||||
|
||||
&__tag {
|
||||
@ -79,12 +87,8 @@
|
||||
}
|
||||
|
||||
&__footer {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
bottom: 5px;
|
||||
|
||||
.van-button {
|
||||
margin-left: 5px;
|
||||
}
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
flex: none;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
lazy-load="{{ lazyLoad }}"
|
||||
class="van-card__img thumb-class"
|
||||
/>
|
||||
<slot wx:else name="thumb" />
|
||||
<slot name="thumb" />
|
||||
<van-tag
|
||||
wx:if="{{ tag }}"
|
||||
mark
|
||||
@ -19,16 +19,15 @@
|
||||
</view>
|
||||
|
||||
<view class="van-card__content">
|
||||
<view class="van-card__left">
|
||||
<view wx:if="{{ title }}" class="van-card__title van-multi-ellipsis--l2 title-class">{{ title }}</view>
|
||||
<slot wx:else name="title" />
|
||||
<view wx:if="{{ title }}" class="van-card__title van-multi-ellipsis--l2 title-class">{{ title }}</view>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ desc }}" class="van-card__desc van-ellipsis desc-class">{{ desc }}</view>
|
||||
<slot wx:else name="desc" />
|
||||
<view wx:if="{{ desc }}" class="van-card__desc van-ellipsis desc-class">{{ desc }}</view>
|
||||
<slot wx:else name="desc" />
|
||||
|
||||
<slot name="tags" />
|
||||
</view>
|
||||
<view class="van-card__right">
|
||||
<slot name="tags" />
|
||||
|
||||
<view class="van-card__bottom">
|
||||
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
|
||||
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
|
||||
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
||||
|
Loading…
x
Reference in New Issue
Block a user