From 29dbd66c805dd7fb209e18489917a6e05e2218e1 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 14 Nov 2020 08:56:46 +0800 Subject: [PATCH] feat(ImagePreview): passing current index to index slot (#7552) --- src/image-preview/ImagePreview.js | 2 +- src/image-preview/README.md | 8 ++++---- src/image-preview/README.zh-CN.md | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/image-preview/ImagePreview.js b/src/image-preview/ImagePreview.js index 9b5d6156b..1986f6372 100644 --- a/src/image-preview/ImagePreview.js +++ b/src/image-preview/ImagePreview.js @@ -140,7 +140,7 @@ export default createComponent({ if (this.showIndex) { return (
- {this.slots('index') || + {this.slots('index', { index: this.active }) || `${this.active + 1} / ${this.images.length}`}
); diff --git a/src/image-preview/README.md b/src/image-preview/README.md index f8e5e62c0..c1c2deae6 100644 --- a/src/image-preview/README.md +++ b/src/image-preview/README.md @@ -163,10 +163,10 @@ export default { ### Slots -| Name | Description | -| ----- | -------------------------------------------- | -| index | Custom index | -| cover | Custom content that covers the image preview | +| Name | Description | SlotProps | +| --- | --- | --- | +| index | Custom index | { index: index of current image } | +| cover | Custom content that covers the image preview | - | ### onClose Parematers diff --git a/src/image-preview/README.zh-CN.md b/src/image-preview/README.zh-CN.md index d9035a953..93b6634a1 100644 --- a/src/image-preview/README.zh-CN.md +++ b/src/image-preview/README.zh-CN.md @@ -205,10 +205,10 @@ export default { 通过组件调用 `ImagePreview` 时,支持以下插槽: -| 名称 | 说明 | -| ----- | ------------------------------ | -| index | 自定义页码内容 | -| cover | 自定义覆盖在图片预览上方的内容 | +| 名称 | 说明 | 参数 | +| ----- | ------------------------------ | ------------------------- | +| index | 自定义页码内容 | { index: 当前图片的索引 } | +| cover | 自定义覆盖在图片预览上方的内容 | - | ### onClose 回调参数