@antmjs/vantui
Version:
一套适用于Taro3及React的vantui组件库
69 lines (58 loc) • 1.33 kB
text/less
/* stylelint-disable no-descending-specificity */
@import '../style/var.less';
.van-image {
position: relative;
display: inline-block;
&--round {
overflow: hidden;
border-radius: 50%;
.van-image__img {
border-radius: inherit;
}
}
&__img,
&__error,
&__loading {
display: block;
width: 100%;
height: 100%;
}
&__error,
&__loading {
position: absolute;
top: 0;
left: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.theme(color, '@image-placeholder-text-color');
.theme(font-size, '@image-placeholder-font-size');
.theme(background-color, '@image-placeholder-background-color');
}
&__loading-icon {
.theme(color, '@image-loading-icon-color');
.theme(font-size, '@image-loading-icon-size') !important;
}
&__error-icon {
.theme(color, '@image-error-icon-color');
.theme(font-size, '@image-error-icon-size') !important;
}
}
// h5下面生效
.image-class .taro-img__mode-aspectfit {
width: 100%;
height: 100%;
max-width: none ;
max-height: none ;
object-fit: contain;
}
.image-class .taro-img__mode-center {
object-fit: none;
display: block;
width: 100%;
height: 100%;
}
.image-class .taro-img__mode-heightfix {
height: 100%;
}