mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[improvement] Card: add thumb link prop (#706)
This commit is contained in:
parent
afeed567d2
commit
a8d7d248a1
@ -54,6 +54,8 @@
|
||||
| price | 商品价格 | `String | Number` | - |
|
||||
| centered | 内容是否垂直居中 | `String` | `false` |
|
||||
| currency | 货币符号 | `String` | `¥` |
|
||||
| thumb-link | 点击左侧图片后的跳转链接 | `String` | - |
|
||||
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | `String` | `navigateTo` |
|
||||
|
||||
### Slot
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
.van-card {
|
||||
color: @text-color;
|
||||
height: 100px;
|
||||
font-size: 16px;
|
||||
font-size: 12px;
|
||||
background: #fafafa;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
@ -55,9 +55,8 @@
|
||||
}
|
||||
|
||||
&__desc {
|
||||
color: @gray-darker;
|
||||
font-size: 12px;
|
||||
max-height: 20px;
|
||||
color: @gray-darker;
|
||||
}
|
||||
|
||||
&__price,
|
||||
@ -68,13 +67,14 @@
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&__price {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
&__num {
|
||||
color: @gray-darker;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
&__tag {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
&__tag {
|
||||
|
@ -17,9 +17,23 @@ VantComponent({
|
||||
title: String,
|
||||
price: String,
|
||||
centered: Boolean,
|
||||
thumbLink: String,
|
||||
linkType: {
|
||||
type: String,
|
||||
value: 'navigateTo'
|
||||
},
|
||||
currency: {
|
||||
type: String,
|
||||
value: '¥'
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClickThumb() {
|
||||
const { thumbLink } = this.data;
|
||||
if (thumbLink) {
|
||||
wx[this.data.linkType]({ url: thumbLink });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
<view class="custom-class van-card {{ centered ? 'van-card--center' : '' }}">
|
||||
<view class="van-card__thumb">
|
||||
<view class="van-card__thumb" bind:tap="onClickThumb">
|
||||
<image wx:if="{{ thumb }}" src="{{ thumb }}" class="van-card__img thumb-class" />
|
||||
<slot wx:else name="thumb" />
|
||||
<van-tag
|
||||
|
Loading…
x
Reference in New Issue
Block a user