Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
//将methods对象通过exportMethods导出去
this.props.exportMethods && this.props.exportMethods(this.methods);
this.methods.updateSize();
removeClass(this.checkboxEl, "z-scheduling-hidden");
removeClass(this.contentEl, "z-scheduling-hidden");
this.swiper = new Swiper(this.swiperElement, {
autoplay: false,
direction: "horizontal",
loop: false,
shortSwipes: false,
longSwipesRatio: 0.05,
longSwipesMs: 100,
grabCursor: false,
speed: 1200,
pagination: {
el: this.swiperPaginationEl,
clickable: true,
// type : 'custom',
// renderCustom:(swiper, current, total)=>{
// }
},
createSwiper() {
const { pagination, navigation, ...others } = this.props.swiperOptions;
if (pagination) {
pagination.el && delete pagination.el;
}
if (navigation) {
navigation.nextEl && delete navigation.nextEl;
navigation.prevEl && delete navigation.prevEl;
}
return new Swiper(this.swiperElement, {
autoplay: true,
loop: false,
// 如果需要分页器
pagination:
pagination === false
? pagination
: {
el: this.paginationElement,
...(pagination ? pagination : {}),
},
// 如果需要前进后退按钮
navigation:
navigation === false
? navigation
: {
nextEl: this.nextElement,
buildSwiper() {
this.swiper = new Swiper(ReactDOM.findDOMNode(this), objectAssign({}, this.props));
}