这是我的laravel 9项目的composer.json文件
"devDependencies": {
"@popperjs/core": "^2.11.6",
"axios": "^1.1.2",
"bootstrap": "^5.2.3",
"bootstrap-icons": "^1.10.3",
"laravel-vite-plugin": "^0.7.2",
"lodash": "^4.17.19",
"postcss": "^8.1.14",
"sass": "^1.56.1",
"vite": "^4.0.0"
},
这是我的资源/js/app. js文件
import './bootstrap'
import '../sass/app.scss'
import * as bootstrap from 'bootstrap'
import '~bootstrap-icons/font/bootstrap-icons.css'
这是我的资源/sass/app.scss
// Fonts
@import url('https://fonts.bunny.net/css?family=Nunito');
// Variables
@import 'variables';
// Bootstrap
@import 'bootstrap/scss/bootstrap';
@import '~bootstrap-icons/font/bootstrap-icons.css';
现在,我的视图有引导图标类,但图标在浏览器中看不到。
<i class="fs-4 bi-speedometer2">
<i class="fs-4 bi-house">
我在浏览器中没有看到任何图标
1条答案
按热度按时间kxeu7u2r1#
Laravel 9没有内置的Bootstrap 5图标支持。但是,您可以通过安装必要的依赖项并相应地配置您的项目,轻松地将Bootstrap 5图标添加到您的Laravel 9应用程序。
通过运行以下命令将Bootstrap icons包添加到项目中:
安装包后,您需要导入项目的app.scss文件中的图标。
要使用这些图标,可以使用包提供的bi类。
如果你想使用javascript图标,你需要导入app.js文件中的图标,并使用软件包提供的icons()方法。
你也可以使用SVG格式的图标,如果你需要的话。