<template>
    <view class="navbar" v-if="modal.length > 0">
        <view class="navbar-item" v-for="(item, index) in navbarList" :key="index" @click.stop="$emit('click', item)">
            <image class="navbar-icon" :src="item.image" mode="widthFix"></image>
            <view class="navbar-label" v-text="item.name"></view>
        </view>
    </view>
</template>

<script>
export default {
    name: 'cm-navbar',
    props: {
        modal: {
            type: Array,
            default: []
        }
    },
    computed: {
        navbarList() {
            return this.modal.map(item => {
                item.id = item.bigTypeId
                item.image = item.crmIcon
                return item
            })
        }
    }
}
</script>

<style lang="scss" scoped>
.navbar {
    @extend .cm-flex-between;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: 40rpx 28rpx 12rpx;
    background: #fff;
    .navbar-item {
        @extend .cm-flex-center;
        flex-direction: column;
        width: 25%;
        padding-bottom: 28rpx;

        .navbar-icon {
            width: 110rpx;
            height: 110rpx;
        }
        .navbar-label {
            margin-top: 12rpx;
            font-size: 28rpx;
            color: #666;
        }
    }
}
</style>
