gaoluyang
3 天以前 92230c9a97dc9ce9df3313d11d26999c04bb6b26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<template>
    <view>
        <view class="top-swiper">
            <view class="box">
                <view style="height: 44px;"></view>
                <swiper class="swiper" :previous-margin="swiper.margin" :next-margin='swiper.margin' :circular="true"
                    @change="swiperChange">
                    <swiper-item v-for="(item,index) in card_menu" :key="index" @click="toUrl(item.url)">
                        <!-- <image class='le-img' :src='item' :class="{'le-active':swiper.index == index}"></image> -->
                        <view class="le-img" :class="{'le-active':swiper.index == index}">
                            <view class="img_box">
                                <image class="card_img" :src="item.img" mode="aspectFill"></image>
                            </view>
                            <view class="detail_box">
                                <view class="title_box">{{item.title}}</view>
                                <view class="author_box">By:{{item.author}}</view>
                            </view>
                        </view>
                    </swiper-item>
                </swiper>
            </view>
        </view>
    </view>
</template>
 
<script>
    import Common from '../../static/js/common'
    export default {
        props: {
            card_menu: {
                type: Array,
                default: []
            }
        },
        data() {
            return {
                swiper: {
                    margin: "150rpx",
                    index: 0,
                    list: [
                        "/static/images/douyin/0.jpg",
                        "/static/images/douyin/4.jpg",
                        "/static/images/douyin/7.jpg",
                    ]
                }
            }
        },
        components: {
 
        },
        mounted() {
 
        },
        methods: {
            //swiper滑动事件
            swiperChange: function(e) {
                this.swiper.index = e.detail.current;
            },
            toUrl(url){
                Common.navigateTo(url);
            }
        }
    }
</script>
 
<style lang="scss">
    .top-swiper {
        margin-bottom: 30rpx;
 
        .box {
            padding-top: var(--status-bar-height);
            box-sizing: content-box;
            position: absolute;
            z-index: 5;
            top: 0;
            left: 0;
            width: 100%;
            height: auto;
        }
 
        .swiper {
            height: 600rpx;
            margin: 0 20rpx;
 
            .le-img {
                width: 100%;
                height: 100%;
                display: block;
                transform: scale(0.9);
                transition: transform 0.3s ease-in-out 0s;
                border-radius: 10px;
                background-color: #fff;
                overflow: hidden;
 
                &.le-active {
                    transform: scale(1);
                }
 
                .img_box {
                    width: 100%;
                    height: 65%;
                    overflow: hidden;
 
                    .card_img {
                        height: 100%;
                        width: 100%;
                    }
                }
 
                .detail_box {
                    width: 100%;
                    height: 35%;
                    overflow: hidden;
 
                    .title_box {
                        width: 100%;
                        text-align: center;
                        font-size: 40rpx;
                        margin: 30rpx 0;
                    }
 
 
 
                    .author_box {
                        width: 100%;
                        text-align: center;
                        font-size: 30rpx;
                        position: relative;
                        height: 80rpx;
                        line-height: 80rpx;
 
                        &::before {
                            content: "";
                            height: 1px;
                            width: 150rpx;
                            position: absolute;
                            transform: translateX(-50%);
                            left: 50%;
                            top: 0;
                            background: #000;
                        }
                    }
                }
            }
 
        }
    }
</style>