diff --git a/src/image/index.js b/src/image/index.js index 090812c..9e51555 100644 --- a/src/image/index.js +++ b/src/image/index.js @@ -6,6 +6,7 @@ import { css, html, Component, styleMap } from '@bd/core' import '../icon/index.js' +import './preview.js' class Image extends Component { static props = { src: '', @@ -55,6 +56,11 @@ class Image extends Component { this.status = 'loaded' this.$requestUpdate() } + onClick() { + if (this.previewSrcList.length) { + window.imagePreview(this.previewSrcList) + } + } render() { let { lazy, @@ -62,10 +68,12 @@ class Image extends Component { status, fit, alt, + previewSrcList, 'referrer-policy': referrerPolicy } = this let styles = styleMap({ - 'object-fit': fit + 'object-fit': fit, + cursor: previewSrcList.length ? 'pointer' : 'default' }) let $slot = '' if (status === 'loading') { @@ -76,7 +84,7 @@ class Image extends Component { ` } return html` -
+