carousel.vue
2.12 KB
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
<template>
<Row>
<i-col span="2">
Current Index
<p>{{ currentIndex }}</p>
</i-col>
<i-col span="2">
<p>Autoplay</p>
<Switch :checked.sync="autoplay" size="small"></Switch>
</i-col>
<i-col span="4">
Speed <Slider :value.sync="autoplaySpeed" :min="300" :max="5000"></Slider>
</i-col>
<i-col span="4">
Switch To
<Button-group>
<i-button @click="currentIndex = 0">0</i-button>
<i-button @click="currentIndex = 1">1</i-button>
<i-button @click="currentIndex = 2">2</i-button>
</Button-group>
</i-col>
<i-col span="4">
<i-button @click="push">Push</i-button>
<i-button @click="remove = true">Remove</i-button>
</i-col>
</Row>
<Carousel style="width: 50%; border: solid 1px #000"
:current-index.sync="currentIndex"
:autoplay="autoplay"
:autoplay-speed="autoplaySpeed"
easing="linear">
<Carousel-item v-if="!remove">
<Alert type="warning" show-icon>
警告提示文案
<template slot="desc">
警告的提示描述文案警告的提示描述文案警告的提示描述文案
</template>
</Alert>
</Carousel-item>
<Carousel-item style="text-align: center">
<Icon type="checkmark" style="font-size: 5em"></Icon>
</Carousel-item>
<Carousel-item>test3</Carousel-item>
<Carousel-item v-for="item in pushItem" track-by="$index">
<Icon type="checkmark" style="font-size: 5em"></Icon>{{item}}
</Carousel-item>
</Carousel>
</template>
<script>
export default {
data () {
return {
currentIndex: 0,
autoplay: true,
autoplaySpeed: 2000,
remove: false,
pushItem: []
}
},
methods: {
push () {
this.pushItem.push('test');
}
}
}
</script>