Swiper.js分页自定义项目符号将不会单击以移至下一张幻灯片

时间:2020-07-28 19:27:51

标签: javascript html angular swiper.js

从swiper.js单击时,我无法使自定义项目符号滑动。

这是我的stackblitz

我添加了config属性

'clickable:true'

这是我的刷卡代码

private pagination: SwiperPaginationInterface = {
  el: '.swiper-pagination',
  type: 'bullets',
  clickable: true,
  renderBullet: function(index, className) {
    return '<span class="' + className + '">' + (index === 0 ? 'info ' : 'students') + '</span>';
  },
};
config: SwiperConfigInterface = {
  observer: true,
  observeParents: true,
  observeSlideChildren: true,
  direction: 'horizontal',
  threshold: 50,
  spaceBetween: 0,
  slidesPerView: 1,
  centeredSlides: true,
  slideToClickedSlide: true,
  pagination: this.pagination,
  navigation: true,
  // width: 200,
  // setWrapperSize: true,
};

1 个答案:

答案 0 :(得分:2)

该操作无效,因为由于该Angular库的作者提供的import React, { useState } from 'react'; const CardTradeSim = (props) => { const [ObtenerdataETH, setObtenerdataETH] = useState([]); const [ObtenerdataBTC, setObtenerdataBTC] = useState([]); const [ObtenerdataXRP, setObtenerdataXRP] = useState([]); const DevuelveValorCrypto = testing => { console.log("check received: ", testing) const TipoCrypto = testing; let test123 = ObtenerdataETH.price console.log("check received: valor de test123", test123) } return <DIV> bla bla {DevuelveValorCrypto({})} </DIV> }; css规则,您无法单击它们:

pointer-events: none

解决方案是针对任何事件将其打开:

swiper>.swiper.s-wrapper .swiper-pagination {
    pointer-events: none;
}

Forked Stackblitz

github中也有a similar issue