template中
<van-uploader max-count="1"
upload-text="上传身份证正面"
:upload-icon="require('../../assets/身份证正面.jpg')"
v-model="frontFileList"
:after-read="uploadIDcardFront"
></van-uploader>
css样式需要更改
/deep/ .van-uploader__upload,
/deep/ .van-image,
/deep/ .van-uploader__preview-image{
width: 44vw;
height: 110px;
}
/deep/ .van-uploader__upload-text {
margin-top: 8px;
color: #969799;
font-size: 12px;
position: absolute;
bottom: 0;
width: 100%;
height: 30px;
line-height: 30px;
background: #1da4f2;
color: #fff;
text-align: center;
}
/deep/ .van-uploader__upload,
/deep/ .van-image{
background: #E8F6FE;
border-radius: 10px;
overflow: hidden;
}
/deep/ .van-icon__image {
width: 4em;
height: 3em;
-o-object-fit: contain;
object-fit: contain;
margin-bottom: 23px;
}
本文仅供自己学习,不喜勿喷