Uncaught TypeError: Cannot read properties of null (reading 'add')

Uncaught TypeError: Cannot read properties of null (reading 'add')

下面是我的滑块代码我得到了无法读取的错误 属性 空读取请添加 needfull $('.main_images').slick({ 幻灯片显示:1, 幻灯片滚动:1, 箭头:错误, asNavFor: '.thumb_images' });

$('.thumb_images').slick({
  slidesToShow: 4,
  slidesToScroll: 1,
  asNavFor: '.main_images',
  dots: false,
  focusOnSelect: true,
  vertical: true,
  arrows:false,
  infinite: false,
  responsive: [
    {
      breakpoint: 481,
      settings: {
        vertical: false,
        infinite: true,
        slidesToShow: 3,
        slidesToScroll: 1

      }
    }
  ]
});

});

那是因为调用了两次 init。试试下面的代码...

$('.thumb_images').not('.slick-initialized').slick({
  slidesToShow: 4,
  slidesToScroll: 1,
  asNavFor: '.main_images',
  dots: false,
  focusOnSelect: true,
  vertical: true,
  arrows:false,
  infinite: false,
  responsive: [
    {
      breakpoint: 481,
      settings: {
        vertical: false,
        infinite: true,
        slidesToShow: 3,
        slidesToScroll: 1

      }
    }
  ]
});