mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(Image): add more mode (#2908)
This commit is contained in:
parent
0fece1552c
commit
f211bb47ae
@ -2,7 +2,15 @@ import Page from '../../common/page';
|
|||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
fits: ['contain', 'cover', 'fill', 'none', 'scale-down'],
|
fits: [
|
||||||
src: 'https://img.yzcdn.cn/vant/cat.jpeg',
|
'contain',
|
||||||
|
'cover',
|
||||||
|
'fill',
|
||||||
|
'none',
|
||||||
|
'scale-down',
|
||||||
|
'widthFix',
|
||||||
|
'heightFix'
|
||||||
|
],
|
||||||
|
src: 'https://img.yzcdn.cn/vant/cat.jpeg'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -121,6 +121,8 @@
|
|||||||
| contain | 保持宽高缩放图片,使图片的长边能完全显示出来 |
|
| contain | 保持宽高缩放图片,使图片的长边能完全显示出来 |
|
||||||
| cover | 保持宽高缩放图片,使图片的短边能完全显示出来,裁剪长边 |
|
| cover | 保持宽高缩放图片,使图片的短边能完全显示出来,裁剪长边 |
|
||||||
| fill | 拉伸图片,使图片填满元素 |
|
| fill | 拉伸图片,使图片填满元素 |
|
||||||
|
| widthFix | 缩放模式,宽度不变,高度自动变化,保持原图宽高比不变 |
|
||||||
|
| heightFix | 缩放模式,高度不变,宽度自动变化,保持原图宽高比不变 |
|
||||||
| none | 保持图片原有尺寸 |
|
| none | 保持图片原有尺寸 |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
@ -7,7 +7,9 @@ const FIT_MODE_MAP = {
|
|||||||
none: 'center',
|
none: 'center',
|
||||||
fill: 'scaleToFill',
|
fill: 'scaleToFill',
|
||||||
cover: 'aspectFill',
|
cover: 'aspectFill',
|
||||||
contain: 'aspectFit'
|
contain: 'aspectFit',
|
||||||
|
widthFix: 'widthFix',
|
||||||
|
heightFix: 'heightFix'
|
||||||
};
|
};
|
||||||
|
|
||||||
VantComponent({
|
VantComponent({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user