跳到主要内容
版本:v6

ion-img

shadow

Img 是一个标签,当标签在视口中时会延迟加载图像。这在生成大型列表时非常有用,因为图像仅在可见时才加载。该组件内部使用 Intersection Observer,大多数现代浏览器都支持,但在不支持时会回退到使用 setTimeout。

基本用法​

属性​

alt​

说明This attribute defines the alternative text describing the image. Users will see this text displayed if the image URL is wrong, the image is not in one of the supported formats, or if the image is not yet downloaded.
属性alt
类型string | undefined
默认值undefined

src​

说明The image URL. This attribute is mandatory for the <img> element.
属性src
类型string | undefined
默认值undefined

事件​

Name说明冒泡
ionErrorEmitted when the img fails to loadtrue
ionImgDidLoadEmitted when the image has finished loadingtrue
ionImgWillLoadEmitted when the img src has been settrue

方法​

该组件没有可用的公共方法。

CSS 阴影部分​

Name说明
imageThe inner img element.

CSS 自定义属性​

该组件没有可用的 CSS 自定义属性。

插槽​

该组件没有可用的插槽。