Laravel blade use $(document).ready function

前端 未结 2 1388
失恋的感觉
失恋的感觉 2021-01-13 14:32

I\'m trying to use laravel blade templates including some javascript code into child view.

I have my mail app.blade.php file, where is placed string

2条回答
  •  清酒与你
    2021-01-13 14:59

    Please follow this way

    for jquery script file do this

    
    

    and do this for content section

    @extends('layouts.app')
    @section ('content')
    Settings main page
    
    
    
    @endsection
    

    Updated


    Rather to scripting in content section, it would much better and professional way to create another section for scripting in app.blade.php

    normally I follow this way

    
       
        @yield('page-style-files')
      
    
      
        
    @yield('content')
    @yield('page-js-files') @yield('page-js-script')

    so for example your code will look like this

    @extends('layouts.app')
    @section ('content')
      Settings main page    
    @endsection
    
    @section('page-style-files')
     
    @stop
    
    
    @section('page-js-files')
     
    @stop
    
    @section('page-js-script')
    
    @stop
    

提交回复
热议问题