Php 有没有办法将laravel与swiper滑块结合起来

Php 有没有办法将laravel与swiper滑块结合起来,php,laravel,laravel-5,swiper,Php,Laravel,Laravel 5,Swiper,我是新加入laravel的,所以这可能是一个愚蠢的问题,但我正在尝试使用片段来减少代码中的重复,因为我的应用程序上的每个页面都有一个swiper幻灯片 我首先在slider.blade.php中创建了一个分部: <div class="swiper-container"> <div class="swiper-wrapper"> @yield('slide-image') </div> <div class="s


我是新加入laravel的,所以这可能是一个愚蠢的问题,但我正在尝试使用片段来减少代码中的重复,因为我的应用程序上的每个页面都有一个swiper幻灯片

我首先在slider.blade.php中创建了一个分部:

<div class="swiper-container">
    <div class="swiper-wrapper">
        @yield('slide-image')
    </div>

    <div class="swiper-pagination swiper-pagination-white"></div>

    <div class="swiper-button-next swiper-button-white"></div>
    <div class="swiper-button-prev swiper-button-white"></div>
</div>

@产量('幻灯片图像')
然后,我将该部分合并到main.blade.php文件中

<!DOCTYPE html>
<html lang="en">

@include('partials._head')
<body>

@include('partials._pageloader')
@include('partials._navbar')

@include('partials._slider') <!---- Here  ---->
@yield('content')


@include('partials._scrolltotop')   

@include('partials._footer')

@include('partials._bottom')


</body>

</html>

@包括('部分。\头')
@包括('partials.\u pageloader')
@包括('partials.\u navbar')
@包括('partials.\u slider')
@产量(‘含量’)
@包括('partials.\u scroll totop')
@include('partials.\u footer')
@包括('partials.\u bottom')
例如,要在主页上添加幻灯片,请添加滑块图像部分

@extends('main')

@section('title', 'Dialhouse Hotel')
@section('slide-image', 'div class="swiper-slide" style="<img src="http://dialhousehotel.com/wp-content/uploads/2017/07/1.jpg" alt="project-1" heigth="360px" width="360px">"></div>')
@section('content')



    @include('partials._contactform')

    @include('partials._googlemaps')

@endsection   
@extends('main'))
@章节(‘标题’、‘迪亚尔豪斯酒店’)
@部分('slide-image','div class=“swiper-slide”style=”“>”)
@节(“内容”)
@包括('partials.\u contactform')
@包括('partials.\u谷歌地图')
@端部
但是,问题是图像没有出现在页面上。它将
作为字符串输出。

您可以这样做

@section('slide-image')

    <div class="swiper-slide" style="<img src="http://dialhousehotel.com/wp-content/uploads/2017/07/1.jpg" alt="project-1" heigth="360px" width="360px">"></div>

@endsection
@节(“幻灯片图像”)
@端部
@部分(“幻灯片图像”)
@端部

是的,当您添加背景图像:url()而不是img src时,这一点就起作用了。非常感谢。如果我在我的答案中添加
背景图像:url()
,那仍然是回答你的问题吗?不,我做得很好
@section('slide-image')
    <div class="swiper-slide" style="src="{{asset('http://dialhousehotel.com/wp-content/uploads/2017/07/1.jpg')}}""></div>
<img >
@endsection