mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[new feature] Card: add click-thumb event (#3585)
This commit is contained in:
parent
a0378d001f
commit
b5908d783e
@ -63,6 +63,7 @@ Use slot to custom content.
|
||||
| Event | Description | Arguments |
|
||||
|------|------|------|
|
||||
| click | Triggered when clicked | - |
|
||||
| click-thumb | Triggered when thumb clicked | - |
|
||||
|
||||
### Slot
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { use, isDef } from '../utils';
|
||||
import { inherit } from '../utils/functional';
|
||||
import { emit, inherit } from '../utils/functional';
|
||||
import Tag from '../tag';
|
||||
|
||||
// Types
|
||||
@ -54,8 +54,12 @@ function Card(
|
||||
const showOriginPrice = slots['origin-price'] || isDef(props.originPrice);
|
||||
const showBottom = showNum || showPrice || showOriginPrice;
|
||||
|
||||
const onThumbClick = () => {
|
||||
emit(ctx, 'click-thumb');
|
||||
};
|
||||
|
||||
const Thumb = showThumb && (
|
||||
<a href={props.thumbLink} class={bem('thumb')}>
|
||||
<a href={props.thumbLink} class={bem('thumb')} onClick={onThumbClick}>
|
||||
{slots.thumb ? (
|
||||
slots.thumb()
|
||||
) : props.lazyLoad ? (
|
||||
|
@ -63,6 +63,7 @@ Vue.use(Card);
|
||||
| 事件名 | 说明 | 参数 |
|
||||
|------|------|------|
|
||||
| click | 点击时触发 | - |
|
||||
| click-thumb | 点击自定义图片时触发 | - |
|
||||
|
||||
### Slot
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user