mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[new feature] ImagePreview: add change event (#3155)
This commit is contained in:
parent
e8762b2a50
commit
8d1c02cfbd
@ -201,6 +201,7 @@ export default sfc({
|
||||
onChange(active) {
|
||||
this.resetScale();
|
||||
this.active = active;
|
||||
this.$emit('change', active);
|
||||
},
|
||||
|
||||
resetScale() {
|
||||
|
@ -109,6 +109,7 @@ export default {
|
||||
| Event | Description | Parameters |
|
||||
|------|------|------|
|
||||
| close | Triggered when close | { index, url } |
|
||||
| change | Triggered when current image change | index: index of current image |
|
||||
|
||||
### onClose Parematers
|
||||
|
||||
|
@ -37,6 +37,7 @@ test('render image', () => {
|
||||
expect(wrapper.emitted('input')).toBeFalsy();
|
||||
triggerDrag(swipe, 0, 0);
|
||||
expect(wrapper.emitted('input')[0][0]).toBeFalsy();
|
||||
expect(wrapper.emitted('change')[0][0]).toEqual(2);
|
||||
});
|
||||
|
||||
test('async close', () => {
|
||||
|
@ -125,6 +125,7 @@ export default {
|
||||
| 事件 | 说明 | 回调参数 |
|
||||
|------|------|------|
|
||||
| close | 关闭时触发 | { index: 索引, url: 图片链接 } |
|
||||
| change | 切换当前图片时触发 | index, 当前图片的索引 |
|
||||
|
||||
### onClose 回调参数
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user