mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-09-06 16:09:44 +08:00
feat(Card): style update (#2754)
* feat(Card): style update * feat(Card): style update
This commit is contained in:
parent
4ed51fd859
commit
c64d80ab59
@ -70,6 +70,7 @@
|
|||||||
|-----------|-----------|
|
|-----------|-----------|
|
||||||
| title | 自定义标题栏,如果设置了`title`属性则不生效 |
|
| title | 自定义标题栏,如果设置了`title`属性则不生效 |
|
||||||
| desc | 自定义描述栏,如果设置了`desc`属性则不生效 |
|
| desc | 自定义描述栏,如果设置了`desc`属性则不生效 |
|
||||||
|
| price-top | 自定义价格上方区域 |
|
||||||
| thumb | 自定义 thumb,如果设置了`thumb`属性则不生效 |
|
| thumb | 自定义 thumb,如果设置了`thumb`属性则不生效 |
|
||||||
| bottom | 自定义价格下方区域 |
|
| bottom | 自定义价格下方区域 |
|
||||||
| footer | 自定义 footer |
|
| footer | 自定义 footer |
|
||||||
|
@ -33,12 +33,21 @@
|
|||||||
&__img {
|
&__img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
.theme(border-radius, '@border-radius-lg');
|
||||||
}
|
}
|
||||||
|
|
||||||
&__content {
|
&__content {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
min-width: 0; /* hack for flex box ellipsis */
|
min-width: 0; /* hack for flex box ellipsis */
|
||||||
|
.theme(min-height, '@card-thumb-size');
|
||||||
|
|
||||||
|
&--center {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__title,
|
&__title,
|
||||||
@ -64,6 +73,16 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
.theme(color, '@card-price-color');
|
.theme(color, '@card-price-color');
|
||||||
|
.theme(font-size, '@card-price-font-size');
|
||||||
|
|
||||||
|
&-integer {
|
||||||
|
.theme(font-size, '@card-price-integer-font-size');
|
||||||
|
.theme(font-family, '@card-price-font-family');
|
||||||
|
}
|
||||||
|
|
||||||
|
&-decimal {
|
||||||
|
.theme(font-family, '@card-price-font-family');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__origin-price {
|
&__origin-price {
|
||||||
|
@ -19,7 +19,10 @@ VantComponent({
|
|||||||
desc: String,
|
desc: String,
|
||||||
thumb: String,
|
thumb: String,
|
||||||
title: String,
|
title: String,
|
||||||
price: String,
|
price: {
|
||||||
|
type: String,
|
||||||
|
observer: 'updatePrice'
|
||||||
|
},
|
||||||
centered: Boolean,
|
centered: Boolean,
|
||||||
lazyLoad: Boolean,
|
lazyLoad: Boolean,
|
||||||
thumbLink: String,
|
thumbLink: String,
|
||||||
@ -35,6 +38,15 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
updatePrice() {
|
||||||
|
const { price } = this.data;
|
||||||
|
const priceArr = price.toString().split('.');
|
||||||
|
this.setData({
|
||||||
|
integerStr: priceArr[0],
|
||||||
|
decimalStr: priceArr[1] ? `.${priceArr[1]}` : '',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onClickThumb() {
|
onClickThumb() {
|
||||||
this.jumpLink('thumbLink');
|
this.jumpLink('thumbLink');
|
||||||
}
|
}
|
||||||
|
@ -21,17 +21,20 @@
|
|||||||
</van-tag>
|
</van-tag>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="van-card__content">
|
<view class="van-card__content {{ utils.bem('card__content', { center: centered }) }}">
|
||||||
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
|
<view>
|
||||||
<slot wx:else name="title" />
|
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
|
||||||
|
<slot wx:else name="title" />
|
||||||
|
|
||||||
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
|
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
|
||||||
<slot wx:else name="desc" />
|
<slot wx:else name="desc" />
|
||||||
|
|
||||||
<slot name="tags" />
|
<slot name="tags" />
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="van-card__bottom">
|
<view class="van-card__bottom">
|
||||||
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
|
<slot name="price-top" />
|
||||||
|
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }}<text class="van-card__price-integer">{{ integerStr }}</text><text class="van-card__price-decimal">{{ decimalStr }}</text></view>
|
||||||
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</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>
|
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
||||||
<slot name="bottom" />
|
<slot name="bottom" />
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
@font-size-md: 14px;
|
@font-size-md: 14px;
|
||||||
@font-size-lg: 16px;
|
@font-size-lg: 16px;
|
||||||
@font-weight-bold: 500;
|
@font-weight-bold: 500;
|
||||||
|
@price-integer-font-family: Avenir-Heavy, PingFang SC, Helvetica Neue, Arial, sans-serif;
|
||||||
|
|
||||||
// Animation
|
// Animation
|
||||||
@animation-duration-base: .3s;
|
@animation-duration-base: .3s;
|
||||||
@ -52,6 +53,7 @@
|
|||||||
@border-width-base: 1px;
|
@border-width-base: 1px;
|
||||||
@border-radius-sm: 2px;
|
@border-radius-sm: 2px;
|
||||||
@border-radius-md: 4px;
|
@border-radius-md: 4px;
|
||||||
|
@border-radius-lg: 8px;
|
||||||
@border-radius-max: 999px;
|
@border-radius-max: 999px;
|
||||||
|
|
||||||
//ActionSheet
|
//ActionSheet
|
||||||
@ -112,13 +114,16 @@
|
|||||||
@card-font-size: @font-size-sm;
|
@card-font-size: @font-size-sm;
|
||||||
@card-text-color: @text-color;
|
@card-text-color: @text-color;
|
||||||
@card-background-color: @background-color-light;
|
@card-background-color: @background-color-light;
|
||||||
@card-thumb-size: 90px;
|
@card-thumb-size: 88px;
|
||||||
@card-title-line-height: 16px;
|
@card-title-line-height: 16px;
|
||||||
@card-desc-color: @gray-7;
|
@card-desc-color: @gray-7;
|
||||||
@card-desc-line-height: 20px;
|
@card-desc-line-height: 20px;
|
||||||
@card-price-color: @red;
|
@card-price-color: @red;
|
||||||
@card-origin-price-color: @gray-7;
|
@card-origin-price-color: @gray-7;
|
||||||
@card-origin-price-font-size: @font-size-xs;
|
@card-origin-price-font-size: @font-size-xs;
|
||||||
|
@card-price-font-size: @font-size-sm;
|
||||||
|
@card-price-integer-font-size: @font-size-lg;
|
||||||
|
@card-price-font-family: @price-integer-font-family;
|
||||||
|
|
||||||
// Cell
|
// Cell
|
||||||
@cell-font-size: @font-size-md;
|
@cell-font-size: @font-size-md;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user