Laravel 5.4中的模板继承

时间:2017-04-11 08:50:56

标签: php laravel laravel-5 laravel-5.4 laravel-blade

我已将master.blade.php声明为父布局,homepage.blade.php扩展了它。但在Chrome和Microsoft Edge中,它包含在iframe

这是master.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>@yield('title', 'URL Shortner with Safe Browsing')</title>

    @section('headerScripts')
    <!-- Bootstrap -->
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    @show
</head>
<body>
@yield('content')

@section('footerScripts')
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
@show
</body>
</html>

这是homepage.blade.php

@extends('layouts.master')

@section('title', 'URL Shortner with Safe Browsing | Home Page')
@section('headerScripts')
    @parent
    <link rel="stylesheet" href="{{ asset('css/ie10-viewport-bug-workaround.css') }}" />
    <link rel="stylesheet" href="{{ asset('css/cover.css') }}" />
    <script src="{{ asset('js/ie-emulation-modes-warning.js') }}" />

@endsection

@section('content')
    <div class="site-wrapper">

        <div class="site-wrapper-inner">

            <div class="cover-container">

                <div class="masthead clearfix">
                    <div class="inner">
                        <h3 class="masthead-brand">Cover</h3>
                        <nav>
                            <ul class="nav masthead-nav">
                                <li class="active"><a href="#">Home</a></li>
                                <li><a href="#">Features</a></li>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </nav>
                    </div>
                </div>

                <div class="inner cover">
                    <h1 class="cover-heading">Cover your page.</h1>
                    <p class="lead">Cover is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.</p>
                    <p class="lead">
                        <a href="#" class="btn btn-lg btn-default">Learn more</a>
                    </p>
                </div>

                <div class="mastfoot">
                    <div class="inner">
                        <p>Cover template for <a href="http://getbootstrap.com">Bootstrap</a>, by <a href="https://twitter.com/mdo">@mdo</a>.</p>
                    </div>
                </div>

            </div>

        </div>

    </div>
@endsection
@section('footerScripts')
    @parent

@endsection

这是我在浏览器中看到的输出。

enter image description here

通过检查开发人员控制台,我可以看到iframe包装器。

enter image description here

从未遇到过这样的事情。有什么建议。我可能在这里做错了。

enter image description here

2 个答案:

答案 0 :(得分:0)

据我所知,它与laravel无关。似乎插件或浏览器扩展导致该问题。尝试停用所有浏览器扩展,删除代码中的任何js插件,并查看控制台是否有错误。您可以在网络选项卡中查看已加载的javascript文件。

答案 1 :(得分:0)

我可能错了,但这不是Laravel问题。我之前在Chrome中遇到过此iframe问题,它是Avira Browser Safety扩展程序。

还有许多其他扩展可能导致此类问题。您可以通过查看iframe的来源找出它是哪一个。 src="chrome-extension://{id-of-the-extension}"

如果您在chrome://extensions中启用了开发者模式,您将看到扩展名ID,并且应该能够搜索列表并禁用导致此问题的列表。

对于Microsoft Edge也是如此,只需浏览扩展部分即可。