Laravel 6.10.1 引入前端框架Bootstrap日记 - & jQuery

 

1)官方方法

cd /path/of/your/project
composer require laravel/ui --dev
php artisan ui bootstrap
php artisan ui bootstrap --auth
npm install
npm run dev

使用方法

在视图引入以下两句即可生效:


<link rel="stylesheet" href="{{ mix('css/app.css') }}"> 
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script>


 

2.1)土方法 - CDN方法 - 无需存储,但需要外网支持

<link href="https://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<script src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="https://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>

2.2)土方法 - 直接放到public下,简单实用

下载bootstrap包,解压,把css+js文件复制到/public/下面,直接在模版中link即可,例如:

<link href="../../../bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<script src="../../../jquery/2.0.0/jquery.min.js"></script>
<script src="../../../bootstrap/3.0.3/js/bootstrap.min.js"></script>

借鉴

https://learnku.com/docs/laravel/6.x/frontend/5149

https://www.cnblogs.com/itwatcher/p/12106421.html

发布了166 篇原创文章 · 获赞 58 · 访问量 66万+

猜你喜欢

转载自blog.csdn.net/qq285744011/article/details/103913088