| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <view class="item-line" :class="{'line-one':lineType===1,'line-two':lineType===2}">
- <view class="item-img">
- <view class="item-key">{{label}}</view>
- <view class="item-img">
- <view class="img-item" v-for="img in imgList">
- <image :src="img" @click="previewImage(img)" mode="aspectFill"></image>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "item-img",
- components: {},
- props: {
- lineType:{
- type:Number,
- default:0
- },
- label: {
- type: String,
- default: '标题'
- },
- value: {
- default: []
- },
- keyStr: {
- default: true
- },
- typeKeys:{
- default:[]
- }
- },
- data() {
- return {
- imgList:[],
- isShow:true
- }
- },
- watch: {},
- mounted() {
- this.setIsShow()
- this.setImgList()
- },
- methods: {
- setImgList(){
- if(typeof this.value ==='string'){
- this.imgList=[this.value]
- }else {
- this.imgList=this.value
- }
- },
- setIsShow(){
- if(this.keyStr!==true){
- if(this.typeKeys.indexOf(this.keyStr)<0){
- this.isShow=false
- }
- }
- },
- previewImage(img){
- this.$emit('onShowImg',img)
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .item-line{
- padding: 16rpx 0;
- .item-img{
- .item-key{
- color: #999999;
- font-size: 30rpx;
- margin-bottom: 16rpx;
- }
- .item-img{
- height: auto;
- display: flex;
- flex-wrap: wrap;
- .img-item{
- display: inline-block;
- margin-right:12rpx;
- image{
- width: calc((100vw - 100rpx)/4);
- height: calc((100vw - 100rpx)/4);
- border-radius: 8rpx;
- }
- }
- .img-item:nth-of-type(4n+0){
- margin-right:0;
- }
- .img-item:nth-of-type(n+5){
- margin-top:12rpx;
- }
- }
- }
- }
- .line-one{
- padding-top: 0;
- }
- .line-two{
- padding-bottom: 0;
- }
- </style>
|