更新时间:2023-12-02 17:23:58
请按照这种方式
针对jquery脚本文件执行此操作
for jquery script file do this
<script src="{!!url('/js/jquery.min.js')!!}"></script>
然后在内容部分执行此操作
and do this for content section
@extends('layouts.app')
@section ('content')
Settings main page
<script type="text/javascript">
$(document).ready(function() {
alert("Settings page was loaded");
});
</script>
@endsection
已更新
除了在内容部分编写脚本之外,在 app.blade.php
Rather to scripting in content section, it would much better and professional way to create another section for scripting in app.blade.php
通常我会按照这种方式
<html>
<head>
@yield('page-style-files')
</head>
<body>
<div class="wrapper">
@yield('content')
</div>
</body>
@yield('page-js-files')
@yield('page-js-script')
<html>
例如,您的代码将如下所示
so for example your code will look like this
@extends('layouts.app')
@section ('content')
Settings main page
@endsection
@section('page-style-files')
<link href="....css" />
@stop
@section('page-js-files')
<script src=".....js"></script>
@stop
@section('page-js-script')
<script type="text/javascript">
$(document).ready(function() {
alert("Settings page was loaded");
});
</script>
@stop