laravel - Laravel:如何在选定视图中包含外部链接
问题描述
我已经在<header>
我的索引视图的标签下包含了所有的 css 和 js 外部链接。
现在有一些我想要的外部链接load on selected views only
,
我可以在该视图上单独添加链接,但是that link will go out of <head> tag
。
如何仅从<header> tag of index view
.
我试过了
<head>
...other links
@if(View::exists('ispblade.calendar'))
@include('ispblade.calendar_links')
@endif
</head>
但它正在加载选定的链接all views
。
解决方案
你需要使用stacks
它。
在布局中:
<head>
<!-- Head Contents -->
@stack('scripts')
</head>
在您看来:
@push('scripts')
<script src="/example.js"></script>
@endpush
推荐阅读
- node.js - ElectronJS - 将文件夹添加到收藏夹 [macOS]
- c++ - 将线段投影到网格上
- javascript - 在不使用 javascript 的情况下使内联 SVG 在浏览器中响应?
- javascript - Campaign Monitor Ajax 表单提交
- firebase - 允许经过身份验证的用户创建文档的 Firestore 规则不起作用
- javascript - 如何为图表 js 数据标签插件格式化程序创建变量
- c# - C# | 如何在 Web 浏览器中选择下拉选项?
- java - 在 Azure VM 上使用 NGINX 对其他 Azure VM 进行负载平衡
- android - 从 Google Play 安装但从 Android Studio 安装时应用程序崩溃
- reactjs - 存储数据时出错,{}- Redux Persist