我一直在尝试将旋转木马添加到Rails 5应用的新闻部分的顶部。我正在使用rails 5,bootstrap 4和haml。我的旋转木马是
#carousel-example-generic.carousel.slide{"data-ride" => "carousel"}
%ol.carousel-indicators
%li.active{"data-slide-to" => "0", "data-target" => "#carousel-example-generic"}
%li{"data-slide-to" => "1", "data-target" => "#carousel-example-generic"}
%li{"data-slide-to" => "2", "data-target" => "#carousel-example-generic"}
.carousel-inner{:role => "listbox"}
.carousel-item.active
%img{:alt => "First slide", "src" => "#{@news.image.url(:medium)}"}/
.carousel-item
%img{:alt => "Second slide", "src" => "#{@news.image.url(:medium)}"}/
.carousel-item
%img{:alt => "Third slide", "src" => "#{@news.image.url(:medium)}"}/
%a.left.carousel-control{"data-slide" => "prev", :href => "#carousel-example-generic", :role => "button"}
%span.icon-prev{"aria-hidden" => "true"}
%span.sr-only Previous
%a.right.carousel-control{"data-slide" => "next", :href => "#carousel-example-generic", :role => "button"}
%span.icon-next{"aria-hidden" => "true"}
%span.sr-only Next
我收到了错误; TypeError:无法读取未定义的属性“offsetWidth”。
我已经看到了这个问题的其他示例,但他们的解决方案是他们没有添加活动类,但我在项目和列表项上都有它们。不知道是否有其他人可以看到我的错误或遇到这个问题?