Twitter bootstrap Yii2:如何使用引导类渲染部分?

Twitter bootstrap Yii2:如何使用引导类渲染部分?,twitter-bootstrap,controller,yii2,html.renderpartial,Twitter Bootstrap,Controller,Yii2,Html.renderpartial,我正在尝试使用renderPartial函数和引导类 这是我在控制器文件中的函数: public function actionPrintReport() { Yii::$app->response->format = 'pdf'; return $this->renderPartial('_myReport', []); } 这是呈现的my _myReport文件:我自己的样式有效,但引导类无效 <div class="box box-war

我正在尝试使用renderPartial函数和引导类

这是我在控制器文件中的函数:

public function actionPrintReport() {
    Yii::$app->response->format = 'pdf';
    return $this->renderPartial('_myReport', []);
}
这是呈现的my _myReport文件:我自己的样式有效,但引导类无效

<div class="box box-warning">
    <div class="box-body">
        Text
    </div>
</div>

正文
但是结果没有显示任何引导类:


我也尝试了renderAjax,但结果是一样的。

这就是函数的要点

渲染视图而不应用布局

此方法与render()的不同之处在于它不应用任何布局

renderPartial函数通常用于在一个页面中多次呈现同一代码块。你在这里的预期结果是什么?你想干什么

registerAssets通常加载在主视图文件(未渲染的文件)中。您应该查看主布局文件并了解如何加载资源。

您需要:

Asset::register($this);

在您看来
\u myReports

您检查过引导css是否正确加载了吗?我不知道如何检查。引导类在渲染视图中工作,但在渲染部分视图中不工作。我想.box body类有一个css规则,因此您必须使用浏览器检查器检查发生了什么。我刚刚检查了,但引导类没有加载。