如何使用json laravel动态显示旋转木马图像

7gs2gvoe  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(145)

所以我有一个引导4旋转木马分区

<div class="firstHalfRoomPagePart">
        <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
            <ol class="carousel-indicators">
              <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
              <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
              <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner">
                @foreach($room_data as $key => $r)
              <div class="carousel-item {{$key == 0 ? 'active' : '' }}">
                <img src="{{ $room_data ->images[0]}}" class="d-block roomImages" alt="...">
              </div>
              @endforeach
            </div>
            <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
              <span class="carousel-control-prev-icon" aria-hidden="true"></span>
              <span class="sr-only">Previous</span>
            </a>
            <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
              <span class="carousel-control-next-icon" aria-hidden="true"></span>
              <span class="sr-only">Next</span>
            </a>
          </div>
</div>

在carousel inner中,我尝试动态获取图像以在视图中显示它们。
我正在尝试从这里获取json:

"images": [
         "/img/room_img/subbuteo_1.jpg",
         "/img/room_img/subbuteo_2.jpg"
      ],

你知道怎么做吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题