resource-category.vue 3.1 KB
<template>
    <div class="resource-category">
        <a-link class="cate-label" :href="brandLink">品牌<i class="icon icon-right"></i></a-link>
        <p class="cate-label" @click="show=!show">{{label}}<i class="icon" :class="sortClass"></i></p>
        <div class="cate-items" v-if="show">
            <a-link :href="item.url" class="cate-item" v-for="item in items" :key="item.name">{{item.name}}</a-link>
        </div>
    </div>
</template>

<script>
import Resource from './resource';

export default {
    name: 'ResourceTwoImage',
    props: {
        gender: {
            type: String
        },
        label: {
            type: String,
            default: '测试'
        },
        items: {
            type: Array,
            default() {
                return [
                    {
                        name: '大衣',
                        url: 'https://wwww.yohobuy.com'
                    },
                    {
                        name: '裤子',
                        url: 'https://wwww.yohobuy.com'
                    }
                ]
            }
        }
    },
    data() {
        return {
            show: false
        }
    },
    computed: {
        sortClass() {
            return {
                'icon-sort-up': this.show,
                'icon-sort-down': !this.show,
            }
        },
        brandLink() {
            return `/brand?channel=${this.gender}`;
        }
    },
    components: {Resource}
};
</script>

<style lang="scss">
.resource-category {
    padding-left: 20px;

    .cate-label {
        display: block;
        position: relative;
        height: 88px;
        line-height: 88px;
        color: #030303;
        font-size: 32px;
        font-weight: bold;

        .icon {
            position: absolute;
            top: 0;
            right: 20px;
            font-size: 46px;
        }

        .icon.icon-sort-up {
            top: 28px;
        }

        .icon.icon-sort-down {
            top: 6px;
        }

        .icon.icon-right {
            top: 28px;
            right: 26px;
            font-size: 30px;
        }

        &:after {
            content: " ";
            position: absolute;
            left: 0;
            bottom: 0;
            right: 0;
            height: 1px;
            border-top: 1px solid #e0e0e0;
            color: #D9D9D9;
            -webkit-transform-origin: 0 0;
            transform-origin: 0 0;
            -webkit-transform: scaleY(0.5);
            transform: scaleY(0.5);
        }
    }

    .cate-item {
        position: relative;
        color: #030303;
        display: block;
        font-size: 28px;
        padding-left: 30px;
        height: 88px;
        line-height: 88px;

        &:after {
             content: " ";
             position: absolute;
             left: 0;
             bottom: 0;
             right: 0;
             height: 1px;
             border-top: 1px solid #e0e0e0;
             color: #D9D9D9;
             -webkit-transform-origin: 0 0;
             transform-origin: 0 0;
             -webkit-transform: scaleY(0.5);
             transform: scaleY(0.5);
        }
    }
}
</style>