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
<!--
* 动态echar轮播图
-->
<script setup lang="ts">
import { reactive, onMounted, onBeforeUnmount } from 'vue';
import Com from 'src/components';
import { WarpTestData, WarpTestData2, WarpTestData3 } from '../config';
const state = reactive({
list: [] as any,
times: 5000,
});
onMounted(() => {
initData();
});
onBeforeUnmount(() => {
//
});
function initData() {
state.list = WarpTestData;
}
function onDataChange1() {
state.list = WarpTestData;
}
function onDataChange2() {
state.list = WarpTestData2;
}
function onDataChange3() {
state.list = WarpTestData3;
}
function onSetToEnpty() {
state.list = [];
}
function onChangeTimers() {
state.times = 2000;
}
</script>
<template>
<div class="fit">
<div class="my-warp-box">
<Com.ChartCarouselWarp
navigation
item-key="seq"
:list="state.list"
:times="state.times"
>
</Com.ChartCarouselWarp>
</div>
<div class="btns">
<q-btn
label="图表轮播图测试数据1"
@click="onDataChange1"
color="primary"
/>
<q-btn
label="图表轮播图测试数据2"
@click="onDataChange2"
color="primary"
/>
<q-btn
label="图表轮播图测试数据3"
@click="onDataChange3"
color="primary"
/>
<q-btn label="将数据置为空" @click="onSetToEnpty" color="primary" />
<q-btn label="改变轮播时间" @click="onChangeTimers" color="orange" />
</div>
</div>
</template>
<style lang="scss" scoped>
.my-warp-box {
width: 500px;
height: 300px;
}
.btns {
padding-top: $padding-md;
display: flex;
flex-wrap: wrap;
> button {
margin-right: $padding-sm;
margin-bottom: $padding-md;
}
}
</style>