<template>
    <div class="option" :class="[value.length && value[0].type, { length: value.length }]">
        <div class="item-box" v-for="(n, i) in value" :key="i">
            <div class="item">
                <img :src="getFileUrl(n.img)">
                <div class="value">{{ n.value }}</div>
            </div>
        </div>
    </div>
</template>

<script>
import { getFileUrl } from '@/assets/utils/host.js'
export default {
    props: {
        value: { type: Array, default: () => [] }
    },
    data () {
        return {
            getFileUrl
        }
    }
}
</script>

<style lang="less" scoped>
.option {
    display: flex;
    flex-wrap: wrap;
    word-break: break-all;
    line-height: 16px;
    &.column {
        flex-direction: column;
    }
    .tips {
        color: #909399;
        margin-top: 5px;
    }
}
.item {
    display: flex;
    background-color: #fff;
    border: 1px solid #DCDFE6;
    img {
        vertical-align: top;
        object-fit: contain;
        background-color: #f5f5f5;
    }
    .el-radio, .el-checkbox {
        margin-right: 0;
        white-space: normal;
    }
}
.row {
    &.length {
        margin: -5px;
    }
    .item-box {
        width: 25%;
        padding: 5px;
    }
    .item {
        flex-direction: column;
        position: relative;
        padding: 80px 5px 0;
    }
    img {
        width: 100%;
        height: 80px;
        position: absolute;
        top: 0;
        left: 0;
    }
    .value {
        padding: 5px;
    }
}
.column {
    .item-box + .item-box {
        margin-top: 5px;
    }
    .item {
        padding: 5px 10px;
        align-items: center;
    }
    .value {
        margin-left: 10px;
    }
    img {
        width: 32px;
        height: 32px;
    }
    .value {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}
</style>
