YII2 Логин актив CSS не загружен - PullRequest
2 голосов
/ 26 апреля 2019

Я создал Login Asset и Login Layout. Почему страница входа не загружает CSS-файлы?

class LoginAsset extends AssetBundle {

public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
    'gent/css/bootstrap.min.css',
    'gent/css/font-awesome.min.css',
    'gent/css/nprogress.css',
    'gent/css/animate.min.css',
    'gent/css/custom.min.css"',
];
public $js = [
];
public $depends = [
    'yii\web\YiiAsset',
    'yii\bootstrap\BootstrapAsset',
];

}

public function actionLogin() {
    $this->layout = 'login';
    return $this->render('login', [
                'model' => $model,
    ]);
}

<?php

/**
 * @var string $content
 * @var \yii\web\View $this
 */
use app\assets\LoginAsset;
use yii\helpers\Html;

LoginAsset::register($this);
?>
<?php $this->beginPage(); ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta charset="<?= Yii::$app->charset ?>" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <?= Html::csrfMetaTags() ?>
        <title>QAMETWIS</title>
        <?php $this->head() ?>

    </head>
    <body class="login">
        <?php echo $content ?>
    </body>


</html>
<?php $this->endPage(); ?>

Вот страница входа в систему.

enter image description here

1 Ответ

1 голос
/ 26 апреля 2019

Редактировать раздел ниже: (Добавить beginBody)

<body>
<?php $this->beginBody() ?>

  # Code ...

<?php $this->endBody() ?>
</body>
...