为什么外部js文件在laravel 5.6中不起作用?

时间:2018-10-26 07:17:50

标签: javascript jquery laravel-5

以下外部sidemenu bar blade filelaravel 5.6一起使用

<div class="list-group">

    <a href="#" class="list-group-item active"><i class="fa fa-key"></i> <span>App Settings</span></a>
    <a href="{{route('vehicles.myads')}}" class="list-group-item" ><i class="fa fa-credit-card"></i> <span>My Ads</span></a>
    <a href="#" class="list-group-item"><i class="fa fa-question-circle"></i> <span>Support</span></a>
    <a href="#" class="list-group-item"><i class="fa fa-arrow-circle-o-left"></i> <span>Sandbox Account</span></a>
    <a href="#" class="list-group-item"><i class="fa fa-book"></i> <span>QuickStart Overview</span></a>
    <a href="#" class="list-group-item"><i class="fa fa-compass"></i> <span>Documentation</span></a>
</div>

这些是stylesheets中的sidemenu bar blade file

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

sidebar.js文件

$(document).ready(function() {
  $('.list-group-item').click(function(e) {
    e.preventDefault();
    $('.list-group-item').removeClass('active');
    $(this).addClass('active');
  });
});

以上js文件正在突出显示当前页面,而上面的代码在我的刀片文件中使用的情况如下,

@extends('layouts.app')
<script src="{{ url('/js/sidebar.js') }}"></script>
@section('head')

    <link rel="stylesheet" href="{{ asset('css/sidebar.css') }}">
@endsection
@section('content')
<div class="container"> 
    <div class="row">
    @include('_includes.nav.sidebar') 
        <div class="col-md-5 col-md-offset-1">
            @include('layouts.partials.alerts') 
@forelse( $vehicles as $vehicule )
           @if( $vehicule->uploads->count() > 0 )
                        <a href="{{ route('vehicles.show', $vehicule->id) }}">
                            @php
                                $upload = $vehicule->uploads->sortByDesc('id')->first();
                            @endphp
                            <img src="/images/{{ $upload->resized_name }}"></a>
                            {{$vehicule->provincename}}
                          {{$vehicule->milage}}
<br>

<td><a class="button is-outlined" href="{{route('vehicles.edit',$vehicule->id.'/edit/')}}" >Edit</a></td>
                            <td><a class="button is-outlined" href="/myads/{{$vehicule->id}}/delete" onclick="return confirm('Are you sure to want to delete this record?')" >Delete</a></td>
                        </a> 
                    <hr>
                    @endif

            @empty
                <td>No Advertisment to display.</td>
            @endforelse
</div>

</div>
</div>
@endsection

但是在我上面的文件中,当前刀片文件未突出显示。有什么问题,怎么解决?

0 个答案:

没有答案