【发布时间】:2021-07-12 16:54:15
【问题描述】:
我的产量或部分或包含在这里不起作用是我的代码,我认为我已经遵守了所有规则。如您所见,我想调用three.blade.php 我将其命名为@section('script') 并使用yield('script') 将其调用到master.blade.php 但似乎是yield 或section不管用。以下是我的代码:
master.blade.php
<!doctype html>
<html lang="fa" dir="rtl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<link href="{{ asset('themes/css/bootstrap.rtl.min.css') }}" rel="stylesheet">
<link href="{{ asset('themes/css/bootstrap-select.css') }}" rel="stylesheet">
<link href="{{ asset('themes/fontawesome/css/all.min.css') }}" rel="stylesheet">
<link href="{{ asset('themes/css/style.css') }}" rel="stylesheet">
<link href="{{ asset('favicon.ico') }}" rel="shortcut icon" type="image/x-icon"/>
<title> كاربران</title>
</head>
<body>
@include('Home.layouts.sidebar')
<main id="app">
@include('Home.layouts.header')
@yield('content')
</main>
@include('Home.layouts.footer')
@yield('script')
</body>
</html>
index.blade.php
@include('Home.steps.one')
@include('Home.steps.two')
@include('Home.steps.three')
两个.blade.php
<form action="{{ route('book.store') }}" method="post">
@csrf
....
</form>
<table class="table table-striped">
....
</table>
@section('script')
<script>
$(document).on('click', '#book_id', function() {
alert('Hello');
});
</script>
@endsection
三个.blade.php
<form action="{{ route('requisition.store') }}" method="post">
@csrf
....
</form>
<table class="table table-striped">
....
</table>
@section('script')
<script>
$(document).on('click', '#province_id', function() {
alert('Hello');
});
</script>
@endsection
【问题讨论】: