focus.vue 1.42 KB
<template>
    <div class="focus">
        <swipe class="swipe swipe-{{floor.length}}">
            <swipe-item v-for="item in floor" v-bind:style="{backgroundColor: item.bgColor}">
                <a href="{{item.url}}" title="{{item.title}}">
                    <img v-lazy="item.src | resize 750 365">
                </a>
            </swipe-item>
        </swipe>
    </div>
</template>

<script>
    require('yoho-vue-swipe/dist/vue-swipe.css');
    const swipe = require('yoho-vue-swipe');

    module.exports = {
        props: ['floor'],
        components: {
            swipe: swipe.Swipe,
            swipeItem: swipe.SwipeItem
        }
    };
</script>

<style>
    .focus {
        .swipe {
            height: 100%;
        }

        .swipe-1 {
            .swipe-indicators {
                display: none;
            }
        }

        .swipe-item {
            a {
                display: block;
            }
            img {
                width: 100%;
                height: 100%;
            }
        }

        .swipe-indicators {
            left: initial;
            right: 20px;
        }

        .swipe-indicator {
            width: 8px;
            height: 8px;
            background: #ccc;
            opacity: 1;
            vertical-align: middle;

            &.active {
                width: 12px;
                height: 12px;
                background: #fff;
            }
        }
    }
</style>