ant-design-vue/components/vc-slick/demo/SlickGoTo.jsx

61 lines
1.3 KiB
Vue
Raw Normal View History

2019-01-12 03:33:27 +00:00
import '../assets/index.less';
import Slider from '../src/slider';
import imgList from './imglist';
2018-07-20 08:13:21 +00:00
2019-01-12 03:33:27 +00:00
const { abstract01, abstract02, abstract03, abstract04 } = imgList;
2018-07-20 08:13:21 +00:00
export default {
2019-01-12 03:33:27 +00:00
data() {
2018-07-20 08:13:21 +00:00
return {
slideIndex: 0,
updateCount: 0,
2019-01-12 03:33:27 +00:00
};
2018-07-20 08:13:21 +00:00
},
2019-01-12 03:33:27 +00:00
render() {
2018-07-20 08:13:21 +00:00
const settings = {
props: {
dots: false,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
2019-01-12 03:33:27 +00:00
afterChange: () => {
this.updateCount = this.updateCount + 1;
},
beforeChange: (current, next) => {
this.slideIndex = next;
},
2018-07-20 08:13:21 +00:00
},
ref: 'slider',
2019-01-12 03:33:27 +00:00
};
2018-07-20 08:13:21 +00:00
return (
<div>
<h2>Slick Go To</h2>
<p>Total updates: {this.updateCount} </p>
<input
onInput={e => this.$refs.slider.slickGoTo(e.target.value)}
value={this.slideIndex}
2019-01-12 03:33:27 +00:00
type="range"
2018-07-20 08:13:21 +00:00
min={0}
max={3}
/>
<Slider {...settings}>
<div>
<img src={abstract01} />
</div>
<div>
<img src={abstract02} />
</div>
<div>
<img src={abstract03} />
</div>
<div>
<img src={abstract04} />
</div>
</Slider>
</div>
2019-01-12 03:33:27 +00:00
);
2018-07-20 08:13:21 +00:00
},
2019-01-12 03:33:27 +00:00
};