mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
feat(ImagePreview): add cover slot (#4766)
This commit is contained in:
@@ -249,12 +249,20 @@ export default createComponent({
|
||||
if (this.showIndex) {
|
||||
return (
|
||||
<div class={bem('index')}>
|
||||
{this.slots('index') || `${this.active + 1}/${this.images.length}`}
|
||||
{this.slots('index') || `${this.active + 1} / ${this.images.length}`}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
genCover() {
|
||||
const cover = this.slots('cover');
|
||||
|
||||
if (cover) {
|
||||
return <div class={bem('cover')}>{cover}</div>;
|
||||
}
|
||||
},
|
||||
|
||||
genImages() {
|
||||
const imageSlots = {
|
||||
loading: () => <Loading type="spinner" />
|
||||
@@ -306,6 +314,7 @@ export default createComponent({
|
||||
<div class={[bem(), this.className]}>
|
||||
{this.genImages()}
|
||||
{this.genIndex()}
|
||||
{this.genCover()}
|
||||
</div>
|
||||
</transition>
|
||||
);
|
||||
|
Reference in New Issue
Block a user