跳到主要内容
Image
在 Info 表单内,展示一些视觉内容,例如产品、人物或场景。

示例

PCPhonePad
<page title="图片">
<module title="fill">
<image width="200px" height="200px" mode="fill"
src="https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg"></image>
</module>
<module title="contain">
<image width="200px" height="200px" mode="contain"
src="https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg"></image>
</module>
<module title="cover">
<image width="200px" height="200px" mode="cover"
src="https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg"></image>
</module>
<module title="none">
<image width="200px" height="200px" mode="none"
src="https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg"></image>
</module>
<module title="scale-down">
<image width="200px" height="200px" mode="scale-down"
src="https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg"></image>
</module>
</page>

export default XPage({
data: {},

show() {

},
});

Attributes

参数说明类型可选值默认值版本
src图片地址string--PC/Mobile--
mode图片如何适应容器框,同原生object-fitstringfill / contain / cover / none / scale-downfillPC/Mobile--
width设置image容器宽度string--PC/Mobile--
height设置image容器高度string--PC/Mobile--

Mode

可选值说明
contain缩放图片并保持宽高比以完全填充容器,容器可能存在部分空白。
cover缩放图片并保持宽高比以填满容器,容器不会留空白,图片可能被裁剪。
fill缩放图片以填满容器,缩放时不会保持图片的长宽比。
none保持图片尺寸。
scale-down保持图片宽高比,容器尺寸大于图片尺寸,等同none;容器尺寸小于图片尺寸,等同contain