You are reading docs for v2, click here for the latest version.
Image

This is an overview of the most common usage of Image. For more information about the available properties, methods, or events, head over to the complete API documentation for Image.

<Image> 是一个UI组件,它显示来自 ImageSource 或URL 的图像。


显示相对于 app 目录的图像

<Image src="~/logo.png" stretch="none" />

显示URL中的图像

<Image src="https://art.nativescript-vue.org/NativeScript-Vue-White-Green.png" stretch="none" />

显示图像 App_Resources

<Image src="res://icon" stretch="none" />

显示已 base64编码的图像

<Image src="data:Image/png;base64,iVBORw..." stretch="none" />

道具

名称类型描述
srcString 或 ImageSource获取或设置图像的源作为URL或图像源。
imageSourceImageSource获取或设置图像的图像源。
tintColorColor(样式属性)将颜色设置为色调模板图像。
stretchStretch(Style属性)获取或设置调整图像大小以填充其分配空间的方式。
有效值: none, aspectFill, aspectFit, 或 fill。
有关更多信息,请参阅 Stretch。
loadMode获取或设置本地文件系统上图像的加载策略。
有效值: sync 或 async。
默认值: async。
有关更多信息,请参阅 loadMode。

原生组件

AndroidiOS
android.widget.ImageViewUIImageView
Contributors