简体   繁体   English

如何在 Laravel 管理模板中设置自定义 js 文件

[英]How to set custom js file in Laravel admin template

I am using Laravel 5.8 with laravel-admin Template for admin.我正在使用 Laravel 5.8 和 laravel-admin 管理员模板。 Now in some situation i need custom js and css file only for admin specific controller.现在在某些情况下,我需要自定义 js 和 css 文件仅用于管理员特定的 controller。 How to add these Js and css in laravel-admin.如何在 laravel-admin 中添加这些 Js 和 css。

Use,利用,

Admin::js('...your path here');

The path refers to the public directory.该路径是指公共目录。 So, if you have a js file under public directory, use 'your_file_name.js' .因此,如果您在public目录下有一个 js 文件,请使用'your_file_name.js' Or if you had your js file containing in a public subdirectory, use Admin::js('sub_directory/your_file.js')或者,如果您的 js 文件包含在public子目录中,请使用Admin::js('sub_directory/your_file.js')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 laravel 刀片模板中使用 JS 文件? - How to use JS file in laravel Blade Template? 如何在 Django 管理主页中加载自定义 JS 文件? - How to load a custom JS file in Django admin home? 在Laravel 4中,如何从文件中以模板(刀片)纯CSS或JS呈现? - In laravel 4, How to render in template (blade) plain css or js from file? Laravel mix,如何为前端和管理部分设置不同的 css 和 js? - Laravel mix, How to set up different css and js for frontend and admin sections? Rails 3.2 / Active Admin-自定义资产管道路径不起作用,导致ActionView :: Template :: Error(未预编译file.js) - Rails 3.2/Active Admin - Custom asset pipeline path not working, resulting in ActionView::Template::Error (file.js isn't precompiled) 如何在 laravel 刀片模板中包含自定义脚本? - How to include custom script in laravel blade template? Laravel Mix-找不到依赖关系(用于自定义js文件) - Laravel Mix - Dependency was not found (for custom js file) Laravel混合以编译自定义JS文件 - Laravel mix to compile custom JS file Laravel Mix自定义产生大JS文件 - Laravel Mix Custom Produce Big JS File 在rails_admin仪表板上包括一个自定义js文件 - Including a custom js file on rails_admin dashboard
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM