Blame view

test/routers/carousel.vue 3.4 KB
6c9acb08   Rijn   initialize carousel
1
  <template>
bfc11079   Rijn   updated autoplay ...
2
3
4
5
6
7
8
9
10
11
12
13
      <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>
77d460e8   Rijn   added offset func...
14
15
16
17
18
19
20
21
          <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>
5e8be9b3   Rijn   fixed add bug. ad...
22
23
          <i-col span="4">
              <i-button @click="push">Push</i-button>
e9989f2b   Rijn   added horizontal ...
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
              <i-button @click="remove = true">Remove Front</i-button>
          </i-col>
          <i-col span="4">
              <p>Dots</p>
              <Button-group>
                  <i-button @click="dots = 'inside'">Inside</i-button>
                  <i-button @click="dots = 'outside'">Outside</i-button>
                  <i-button @click="dots = 'none'">None</i-button>
              </Button-group>
          </i-col>
          <i-col span="4">
              <p>Trigger</p>
              <Button-group>
                  <i-button @click="trigger = 'click'">Click</i-button>
                  <i-button @click="trigger = 'hover'">Hover</i-button>
              </Button-group>
          </i-col>
          <i-col span="4">
              Arrow
              <Button-group>
                  <i-button @click="arrow = 'hover'">Hover</i-button>
                  <i-button @click="arrow = 'always'">Always</i-button>
                  <i-button @click="arrow = 'never'">Never</i-button>
              </Button-group>
5e8be9b3   Rijn   fixed add bug. ad...
48
          </i-col>
bfc11079   Rijn   updated autoplay ...
49
      </Row>
90f77e40   Rijn   updated carousel ...
50
      <Carousel style="width: 50%; border: solid 1px #000"
bfc11079   Rijn   updated autoplay ...
51
52
          :current-index.sync="currentIndex"
          :autoplay="autoplay"
90f77e40   Rijn   updated carousel ...
53
          :autoplay-speed="autoplaySpeed"
e9989f2b   Rijn   added horizontal ...
54
55
56
          :dots="dots"
          :trigger="trigger"
          :arrow="arrow"
c1af3fac   Rijn   added on-change e...
57
          @on-change="slideChange"
90f77e40   Rijn   updated carousel ...
58
          easing="linear">
8f4e2cf0   Rijn   update pos when s...
59
          <Carousel-item v-if="!remove">
bfc11079   Rijn   updated autoplay ...
60
61
62
63
64
65
66
              <Alert type="warning" show-icon>
                  警告提示文案
                  <template slot="desc">
                      警告的提示描述文案警告的提示描述文案警告的提示描述文案
                  </template>
              </Alert>
          </Carousel-item>
90f77e40   Rijn   updated carousel ...
67
68
69
          <Carousel-item style="text-align: center">
              <Icon type="checkmark" style="font-size: 5em"></Icon>
          </Carousel-item>
41f83010   Rijn   update props and ...
70
          <Carousel-item>test3</Carousel-item>
5e8be9b3   Rijn   fixed add bug. ad...
71
72
73
          <Carousel-item v-for="item in pushItem" track-by="$index">
              <Icon type="checkmark" style="font-size: 5em"></Icon>{{item}}
          </Carousel-item>
41f83010   Rijn   update props and ...
74
      </Carousel>
c1af3fac   Rijn   added on-change e...
75
76
77
      <div>
          <p v-for="item in log">{{item}}</p>
      </div>
6c9acb08   Rijn   initialize carousel
78
79
80
  </template>
  <script>
      export default {
bfc11079   Rijn   updated autoplay ...
81
82
83
84
          data () {
              return {
                  currentIndex: 0,
                  autoplay: true,
5e8be9b3   Rijn   fixed add bug. ad...
85
                  autoplaySpeed: 2000,
8f4e2cf0   Rijn   update pos when s...
86
                  remove: false,
e9989f2b   Rijn   added horizontal ...
87
88
89
                  pushItem: [],
                  arrow: 'hover',
                  trigger: 'click',
c1af3fac   Rijn   added on-change e...
90
91
                  dots: 'inside',
                  log: []
5e8be9b3   Rijn   fixed add bug. ad...
92
93
94
95
96
              }
          },
          methods: {
              push () {
                  this.pushItem.push('test');
c1af3fac   Rijn   added on-change e...
97
98
99
              },
              slideChange (from, to) {
                  this.log.push(`From ${from} To ${to}`);
bfc11079   Rijn   updated autoplay ...
100
101
              }
          }
6c9acb08   Rijn   initialize carousel
102
103
      }
  </script>