保誠-保戶業務員媒合平台
Mila
2021-10-19 1fcd604ad844352dd350ecda3ee870d69e3d85df
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
<template>
<div>
    <el-carousel
        type="card"
        height="200px"
        :autoplay="false"
        indicator-position="none"
        arrow="always"
        ref="carouselRef"
 
    >
        <el-carousel-item
            v-for="(item, index) in 5"
            :key="index"
        >
            <div
                class="fill"
                @touchstart="touchStart"
                @touchend="moveCard"
            >
                <h3>{{ item }}</h3>
                <el-button @click="$router.push('/agentInfo')" size="small">詳細資訊</el-button>
                <el-button @click="isVisibleDialog = true" size="small">+聯絡清單</el-button>
            </div>
 
        </el-carousel-item>
    </el-carousel>
 
    <Ui-Dialog
        :isVisible.sync="isVisibleDialog"
    >
        <span>已加入聯絡清單</span>
    </Ui-Dialog>
 
</div>
</template>
 
<script lang="ts">
import { ElCarousel } from 'element-ui/types/carousel';
import { Vue, Component } from 'vue-property-decorator';
 
@Component
export default class UiCardCarousel extends Vue {
    isVisibleDialog = false;
    startPosition = 0;
    endPosition = 0;
 
    touchStart(event: TouchEvent) {
        this.startPosition = event.changedTouches[0].clientX;
    }
 
    moveCard(event: any) {
        this.endPosition = event.changedTouches[0].clientX;
        if (this.endPosition < this.startPosition) {
            (this.$refs.carouselRef as ElCarousel).next();
            return;
        }
 
        if (this.endPosition > this.startPosition) {
            (this.$refs.carouselRef as ElCarousel).prev();
            return;
        }
    }
 
}
</script>
 
<style lang="scss" scoped>
    .el-carousel__item {
        background-color: #d3dce6;
    }
    .fill {
        width: 100%;
        height: 100%;
        padding: 3px;
    }
</style>