当路由
Route::get('/Bin',[BinCardController::class, 'Index']);
Jquery加载和工作
但是当Route::get('/Bin/{steak}',[BinCardController::class, 'Index']);
jquery不加载时。
即使我输入http://127.0.0.1:5000/bin/。对于最后一个'/' jquery是不加载的。但如果我只保留http://127.0.0.1:5000/bin那么jquery就会加载并工作
为我的应用程序导入jquery app.blade.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>@yield('title')</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,400;1,400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
<link rel="icon" href="img/mdb-favicon.ico" type="image/x-icon" />
<link href="{{asset('css/bootstrap.min.css')}}" rel="stylesheet">
<link href="{{asset('css/mdb.min.css')}}" rel="stylesheet">
<link href="{{asset('css/sidenav.css')}}" rel="stylesheet">
<link href="{{asset('css/style.css')}}" rel="stylesheet">
<link href="{{asset('css/responsive.css')}}" rel="stylesheet">
<link href="{{asset('css/datatables.min.css')}}" rel="stylesheet">
<link href="{{asset('css/datatables-select.min.css')}}" rel="stylesheet">
<link href="{{asset('css/public7ade.css')}}" rel="stylesheet">
{{-- 13.10.2021--}}
<link href="{{asset('css/hover-menu.css')}}" rel="stylesheet">
<link href="{{asset('css/fonts.css')}}" rel="stylesheet">
<link href="{{asset('css/custom-css-for-input.css')}}" rel="stylesheet">
<link href="{{asset('mdb.rtl.min.css')}}" rel="stylesheet">
<link href="{{asset('')}}" rel="stylesheet">
<link href="{{asset('')}}" rel="stylesheet">
<link href="{{asset('')}}" rel="stylesheet">
@yield('script')
</head>
<body class="backgroundLogo">
@include('Layout.menu')
@yield('content')
<script src="js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="{{asset('js/popper.min.js')}}"></script>
<script type="text/javascript" src="{{asset('js/bootstrap.js')}}"></script>
<script type="text/javascript" src="{{asset('js/mdb.min.js')}}"></script>
<script src="{{asset('js/jquery.slimscroll.js')}}"></script>
<script src="{{asset('js/sidebarmenu.js')}}"></script>
<script src="{{asset('js/mdb.min.js')}}"></script>
<script src="{{asset('js/sticky-kit.min.js')}}"></script>
<script src="{{asset('js/custom.min-2.js')}}"></script>
<script src="{{asset('js/datatables.min.js')}}"></script>
<script src="{{asset('js/datatables-select.min.js')}}"></script>
<script src="{{asset('js/custom.js')}}"></script>
<script src="{{asset('js/axios.min.js')}}"></script>
<script src="{{asset('js/bootstrap.min.js')}}"></script>
<script src="{{asset('js/jquery-barcode.min.js')}}"></script>
<script src="{{asset('js/jquery-barcode.js')}}"></script>
<script src="{{asset('js/jquery-qrcode-0.18.0.min.js')}}"></script>
<script src="{{asset('js/jquery-qrcode-0.18.0.js')}}"></script>
<script src="{{asset('js/order.js')}}"></script>
<script src="{{asset('js/create.js')}}"></script>
<script src="{{asset('js/po.js')}}"></script>
<script src="{{asset('js/data-generate.js')}}"></script>
<script src="{{asset('js/BarcodeDownload.js')}}"></script>
<script src="{{asset('js/IncentoryLiveReports.js')}}"></script>
<script src="{{asset('js/goodsReceive.js')}}"></script>
<script src="{{asset('js/goodsIssue.js')}}"></script>
<script src="{{asset('js/BinCard.js')}}"></script>
@yield('script')
</body>
</html>
在我的blade中,我使用app。blade。php
@extends('Layout.app')
@section('content')
@endsection
在任何包含单个'/'的路由中,jquery都可以工作。但是如果有两个或更多的参数'/',jquery将无法加载和工作。在我的控制台日志中所有的jquery文件抛出错误。在这里输入图片描述
应该是这样的
在src
的开始处添加斜杠<script src="/js/jquery-3.4.1.min.js"></script>
或者像对待别人一样使用asset()
。