我对如何解决这个问题感到困惑
这是 Gentelella 布局模板:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gentellela Alela! | </title>
<!-- Bootstrap -->
<link href="{{ asset("css/bootstrap.min.css") }}" rel="stylesheet">
<!-- Font Awesome -->
<link href="{{ asset("css/font-awesome.min.css") }}" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="{{ asset("css/gentelella.min.css") }}" rel="stylesheet">
@stack('stylesheets')
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
@include('includes/sidebar')
@include('includes/topbar')
@yield('main_container')
@include('includes/footer')
</div>
</div>
<!-- jQuery -->
<script src="{{ asset("js/jquery.min.js") }}"></script>
<!-- Bootstrap -->
<script src="{{ asset("js/bootstrap.min.js") }}"></script>
<!-- Custom Theme Scripts -->
<script src="{{ asset("js/gentelella.min.js") }}"></script>
@stack('scripts')
</body>
</html>
如您所见,有一个加载 css 的头部部分和一个加载脚本文件的页脚部分。在我的单页实现中,我放置了这样的部分:
@push('scripts')
<script>
var cancButton='{!! __('messages.tempCreat_txtCanc') !!}';
var nextButton='{!! __('messages.tempCreat_txthNext') !!}';
var prevButton='{!! __('messages.tempCreat_txtPrev') !!}';
</script>
<script src="{{asset('js/jquery-ui.js')}}"></script>
<script type="text/javascript" src="{{asset('/js/mxClient.js')}}"></script>
<script type="text/javascript" src="{{asset("js/app.js")}}"></script>
<script src={{asset('/js/bootstrap2-toggle.min.js')}}></script>
<script src="{{asset("js/jquery.smartWizard.js")}}"></script>
<script src="{{ asset("css/ie10-viewport-bug-workaround.js") }}"></script>
<script type="text/javascript" src="{{ asset("js/xml2json.js") }}"></script>
<script src={{asset('/js/stepper2.js')}}></script>
<script src={{asset('/js/validationJquery.js')}}></script>
<script src="{{asset('js/funzioniEditor.js')}}"></script>
<script src="{{ asset('js/jqueryEditorFunction.js') }}"></script>
@endpush
正如您stack('script')
在页面底部的部分中看到的“我推送”文件。
问题出在插件上,例如:
<script src="{{asset("js/jquery.smartWizard.js")}}"></script>
这导致您在加载插件文件之前看到原始 html……这不好!如果我将事情移到头部也是一个问题,因为侧边栏菜单会神奇地停止工作......
渲染智能向导的$(document).ready(function(){}
功能还在功能中。