引入
- {
-   "usingComponents": {
-     "x-image":"waft-ui/assembly/image/image"
-   }
- }
代码示例
- <x-image height="50rpx" width="50rpx" src="https://gw.alicdn.com/imgextra/i1/O1CN01Ol1xXi1zuXeMTVRjD_!!6000000006774-2-tps-305-305.png"></x-image>
组件样式
axml
- <view class="wrapper">
-   <x-nav-bar showArrow="{{true}}" title="测试图片"></x-nav-bar>
-   <view class="content">
-     <x-image full="{{ true }}" width="400rpx" height="400rpx" src="https://gw.alicdn.com/imgextra/i1/O1CN01dudMzQ1eY0BV29999_!!6000000003882-2-tps-1920-1080.png"></x-image>
-   </view>
- </view>
css
- .wrapper {
-   width: 100%;
-   height: 100%;
-   display: flex;
-   flex-direction: column;
-   justify-content: flex-start;
-   align-items: center;
-   background-color: #eeeeee;
- }
- .content{
-   flex: 1;
-   display: flex;
-   flex-direction: column;
-   justify-content: flex-start;
-   align-items: center;
-   padding-top: 30rpx;
- }
API
- props
| 参数 | 说明 | 类型 | 默认值 |
| —- | —- | —- | —- |
| height | 图片高度 | string | 100rpx |
| width | 图片宽度 | string | 100rpx |
| src | 图片url地址 必传 | string |  |
| resize | stretch:默认值,指定图片按照容器拉伸,有可能使图片产生形变。
 cover:指定图片可以被调整到容器,以使图片完全覆盖背景区域,图片有可能被剪裁。
 contain:指定可以不用考虑容器的大小,把图像扩展至最大尺寸,以使其宽度和高度完全适应内容区域。 | string | stretch |