<tap-photo-browser>

Full-screen photo browser like iOS Photos, supports swiping between photos, pinch and double tap to zoom, pull down to close. It zooms from/to the origin element of the photo when opening and closing.

Example

import { PhotoBrowser } from '@mantou/tap-ui/elements/photo-browser';

PhotoBrowser.open({
  items: photos.map((photo, i) => ({
    src: photo.src,
    thumbnail: photo.thumbnail,
    // Use a function when the element may be re-rendered, e.g. virtual list
    origin: () => listRef.value?.children[i],
  })),
  index,
  scrollToOrigin: true,
});

API

Shadow DOM; Extends GemElement

Static Methods

Method Type Description
open ({ items, index, scrollToOrigin }: PhotoBrowserOptions) => DyPromise<void, { browser: TapPhotoBrowserElement; }> & { browser: TapPhotoBrowserElement; } Opens the browser; settles when dismissed (tap / pull down / CloseWatcher).

Instance Properties

Property(Attribute) Reactive Type
index(index) Yes number
scrollToOrigin(scroll-to-origin) Yes boolean
items Yes PhotoItem[]
close Emitter

Other

Type Value
Event close
Part photo, counter, caption
CSS State closing