index.wxs 641 B

12345678910111213141516171819202122232425
  1. function isPrev(current, index, list) {
  2. return (current - 1 + list.length) % list.length === index;
  3. }
  4. function isNext(current, index, list) {
  5. return (current + 1 + list.length) % list.length === index;
  6. }
  7. function getImageClass(prefix, current, index, list) {
  8. var arr = [prefix + '-swiper__image', prefix + '-class-image'];
  9. if (isPrev(current, index, list)) {
  10. arr.push(prefix + '-class-prev-image')
  11. }
  12. if (isNext(current, index, list)) {
  13. arr.push(prefix + '-class-next-image')
  14. }
  15. return arr.join(' ');
  16. }
  17. module.exports.isPrev = isPrev;
  18. module.exports.isNext = isNext;
  19. module.exports.getImageClass = getImageClass;