mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Uploader): preview-cover slot add index param (#7036)
This commit is contained in:
parent
a78a7b6aa8
commit
f89f939377
@ -320,7 +320,11 @@ export default createComponent({
|
||||
</div>
|
||||
);
|
||||
|
||||
const PreviewCoverContent = this.slots('preview-cover', item);
|
||||
const PreviewCoverContent = this.slots('preview-cover', {
|
||||
index,
|
||||
...item,
|
||||
});
|
||||
|
||||
const PreviewCover = PreviewCoverContent && (
|
||||
<div class={bem('preview-cover')}>{PreviewCoverContent}</div>
|
||||
);
|
||||
|
@ -76,7 +76,7 @@ exports[`preview-cover slot 1`] = `
|
||||
<div class="van-image van-uploader__preview-image"><img src="https://img.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: cover;">
|
||||
<div class="van-image__loading"><i class="van-icon van-icon-photo van-image__loading-icon">
|
||||
<!----></i></div>
|
||||
<div class="van-uploader__preview-cover">https://img.yzcdn.cn/vant/cat.jpeg</div>
|
||||
<div class="van-uploader__preview-cover">url: https://img.yzcdn.cn/vant/cat.jpeg, index: 0</div>
|
||||
</div>
|
||||
<div class="van-uploader__preview-delete"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon">
|
||||
<!----></i></div>
|
||||
@ -85,7 +85,7 @@ exports[`preview-cover slot 1`] = `
|
||||
<div class="van-image van-uploader__preview-image"><img src="https://img.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: cover;">
|
||||
<div class="van-image__loading"><i class="van-icon van-icon-photo van-image__loading-icon">
|
||||
<!----></i></div>
|
||||
<div class="van-uploader__preview-cover">https://img.yzcdn.cn/vant/cat.jpeg</div>
|
||||
<div class="van-uploader__preview-cover">url: https://img.yzcdn.cn/vant/cat.jpeg, index: 1</div>
|
||||
</div>
|
||||
<div class="van-uploader__preview-delete"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon">
|
||||
<!----></i></div>
|
||||
|
@ -531,7 +531,7 @@ test('preview-cover slot', () => {
|
||||
fileList: [{ url: IMAGE }, { url: IMAGE }],
|
||||
},
|
||||
scopedSlots: {
|
||||
'preview-cover': (item) => item.url,
|
||||
'preview-cover': (item) => `url: ${item.url}, index: ${item.index}`,
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user