iview/test/routers/carousel.vue

104 lines
3.4 KiB
Vue
Raw Normal View History

2017-01-16 02:45:11 -06:00
<template>
2017-01-16 04:28:34 -06:00
<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>
2017-01-16 17:43:20 -06:00
<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>
2017-01-16 17:51:03 -06:00
<i-col span="4">
<i-button @click="push">Push</i-button>
2017-01-17 14:29:51 -06:00
<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>
2017-01-16 17:51:03 -06:00
</i-col>
2017-01-16 04:28:34 -06:00
</Row>
2017-01-16 17:37:28 -06:00
<Carousel style="width: 50%; border: solid 1px #000"
2017-01-16 04:28:34 -06:00
:current-index.sync="currentIndex"
:autoplay="autoplay"
2017-01-16 17:37:28 -06:00
:autoplay-speed="autoplaySpeed"
2017-01-17 14:29:51 -06:00
:dots="dots"
:trigger="trigger"
:arrow="arrow"
2017-01-17 14:35:23 -06:00
@on-change="slideChange"
2017-01-16 17:37:28 -06:00
easing="linear">
<Carousel-item v-if="!remove">
2017-01-16 04:28:34 -06:00
<Alert type="warning" show-icon>
警告提示文案
<template slot="desc">
警告的提示描述文案警告的提示描述文案警告的提示描述文案
</template>
</Alert>
</Carousel-item>
2017-01-16 17:37:28 -06:00
<Carousel-item style="text-align: center">
<Icon type="checkmark" style="font-size: 5em"></Icon>
</Carousel-item>
2017-01-16 02:59:46 -06:00
<Carousel-item>test3</Carousel-item>
2017-01-16 17:51:03 -06:00
<Carousel-item v-for="item in pushItem" track-by="$index">
<Icon type="checkmark" style="font-size: 5em"></Icon>{{item}}
</Carousel-item>
2017-01-16 02:59:46 -06:00
</Carousel>
2017-01-17 14:35:23 -06:00
<div>
<p v-for="item in log">{{item}}</p>
</div>
2017-01-16 02:45:11 -06:00
</template>
<script>
export default {
2017-01-16 04:28:34 -06:00
data () {
return {
currentIndex: 0,
autoplay: true,
2017-01-16 17:51:03 -06:00
autoplaySpeed: 2000,
remove: false,
2017-01-17 14:29:51 -06:00
pushItem: [],
arrow: 'hover',
trigger: 'click',
2017-01-17 14:35:23 -06:00
dots: 'inside',
log: []
2017-01-16 17:51:03 -06:00
}
},
methods: {
push () {
this.pushItem.push('test');
2017-01-17 14:35:23 -06:00
},
slideChange (from, to) {
this.log.push(`From ${from} To ${to}`);
2017-01-16 04:28:34 -06:00
}
}
2017-01-16 02:45:11 -06:00
}
</script>