el点击查看大图,小记
关键代码 <template> <div><img :src="xxxxx" @click="picturePreview"/> <!--图片附件,查看大图--> <div class="img-fix-bg" v-if="largerVisible"> <div class="larger-box"><img :src="largerUrl"></div> <i class="el-icon-close close" @click="largerVisible=false"></i> </div> </div> </template> data () { return { largerVisible: false,//查看上传图片之,大图 largerUrl: null,//查看上传图片之,大图 } }, method:{ picturePreview (file) { // 查看大图 this.largerVisible = true; this.largerUrl = file.url; }, } <style lang="less" scoped> .img-fix-bg { width: 100%; height: 100%; position: fixed; left: 0; top: 0; z-index: 99999; background: rgba(0, 0, 0, .6); .larger-box { width: 100%; height: 100%; text-align: center; position: relative; img { max-width: 100%; max-height: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } } .close { position: absolute; right: 30px; top: 30px; color: #fff; font-size: 30px; cursor: pointer; } } .offline-footer { width: 100%; height: 60px; position: fixed; left: 0; bottom: 0; background: #fff; border-top: 1px solid #dadbe3; padding: 12px 30px; z-index: 10; } .offline-footer /deep/ .el-form { .el-button { padding: 10px 35px; } .el-form-item { margin-right: 30px; } .remark { width: 250px; height: 36px; position: relative; .el-textarea { &:before { position: absolute; left: 0; top: 0; line-height: 36px; padding-left: 15px; } } } } </style>