prefer-list.vue 2.3 KB
<template>
    <div>
        <div class='title-wrap'>{{title}}</div>
        <div class="list-wrap">
            <div class="product-item" v-for="item in list" :key="item.url">
                <a :href="item.url">
                    <a v-good-href="item">
                        <img v-img-src="{src: item.default_images, width: 250, height: 335}">
                        <p class="product-name">{{item.product_name}}</p>
                    </a>
                </a>
                <div class="price">
                    <span class="discount" v-if="item.sales_price">¥{{item.sales_price}}</span>
                    <span class="market" :class="{'line-through': item.sales_price}">¥{{item.market_price}}</span>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
    export default {
        props: ['list', 'title']
    };
</script>
<style>
    .title-wrap {
        height: 80px;
        font-size: 32px;
        color: #000;
        text-align: left;
        line-height: 80px;
    }

    .list-wrap {
        width: 690px;
        max-width: 690px;
        overflow-y: hidden;
        overflow-x: auto;
        white-space: nowrap;

        .product-item {
            display: inline-block;
            width: 250px;
            padding: 0;
            margin-right: 20px;
            text-align: left;

            img {
               width: 100%;
               display: block;
            }

            .product-name {
                margin-top: 20px;
                max-width: 200px;
                font-size: 22px;
                color: #000;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .price .discount {
                margin-top: 10px;
                color: #f00;
                font-size: 22px;
                display: inline-block;
                margin-left: 7px;
                vertical-align: bottom;
            }

            .price .market {
                margin-left: 5px;
                font-size: 18px;
                margin-top: 10px;
                color: #b0b0b0;
            }


            .line-through {
                text-decoration: line-through;
            }
        }

        .item-list:nth-child(odd) {
            padding-right: 1px;
        }
    }
</style>