yii2-bootstrap5/docs/guide-zh-CN/basic-usage.md
2021-08-05 09:21:05 +02:00

14 lines
639 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

使用
===========
Yii不会将 bootstrap 合并到PHP代码中因为HTML本身是非常简单的。猛击 [bootstrap 文档页](https://getbootstrap.com/docs/) 查看如何使用 bootstrap. 但是 Yii 还是提供了在框架中更为方便的管理和使用 bootstrap的方式`@app/assets` 路径下的 `AppAsset.php` 文件中,添加如下代码即可:
```php
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap5\BootstrapAsset', // this line
];
```
通过 Yii 的资源管理器asset manager引入 bootstrap ,可最小化的引入 bootstrap 并在需要时合并自定义资源文件一起使用。