<template>
    <view class="navbar">
        <view class="navbar-item" v-for="(item, index) in list" :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',
    data() {
        return {
            list: [
                {
                    name: '护肤品',
                    image: 'https://picsum.photos/200/200'
                },
                {
                    name: '护肤品',
                    image: 'https://picsum.photos/200/200'
                },
                {
                    name: '护肤品',
                    image: 'https://picsum.photos/200/200'
                },
                {
                    name: '护肤品',
                    image: 'https://picsum.photos/200/200'
                },
                {
                    name: '护肤品',
                    image: 'https://picsum.photos/200/200'
                },
                {
                    name: '护肤品',
                    image: 'https://picsum.photos/200/200'
                },
                {
                    name: '护肤品',
                    image: 'https://picsum.photos/200/200'
                },
                {
                    name: '护肤品',
                    image: 'https://picsum.photos/200/200'
                }
            ]
        }
    }
}
</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>
