mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-13 04:38:03 +08:00
Fixes #2937
This commit is contained in:
@@ -10,6 +10,7 @@ namespace yii\web;
|
|||||||
use Yii;
|
use Yii;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\base\InvalidConfigException;
|
use yii\base\InvalidConfigException;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View represents a view object in the MVC pattern.
|
* View represents a view object in the MVC pattern.
|
||||||
@@ -371,7 +372,7 @@ class View extends \yii\base\View
|
|||||||
} else {
|
} else {
|
||||||
$am = Yii::$app->getAssetManager();
|
$am = Yii::$app->getAssetManager();
|
||||||
$am->bundles[$key] = new AssetBundle([
|
$am->bundles[$key] = new AssetBundle([
|
||||||
'css' => [$url],
|
'css' => [Url::to($url)],
|
||||||
'cssOptions' => $options,
|
'cssOptions' => $options,
|
||||||
'depends' => (array) $depends,
|
'depends' => (array) $depends,
|
||||||
]);
|
]);
|
||||||
@@ -432,11 +433,8 @@ class View extends \yii\base\View
|
|||||||
$this->jsFiles[$position][$key] = Html::jsFile($url, $options);
|
$this->jsFiles[$position][$key] = Html::jsFile($url, $options);
|
||||||
} else {
|
} else {
|
||||||
$am = Yii::$app->getAssetManager();
|
$am = Yii::$app->getAssetManager();
|
||||||
if (strpos($url, '/') !== 0 && strpos($url, '://') === false) {
|
|
||||||
$url = Yii::$app->getRequest()->getBaseUrl() . '/' . $url;
|
|
||||||
}
|
|
||||||
$am->bundles[$key] = new AssetBundle([
|
$am->bundles[$key] = new AssetBundle([
|
||||||
'js' => [$url],
|
'js' => [Url::to($url)],
|
||||||
'jsOptions' => $options,
|
'jsOptions' => $options,
|
||||||
'depends' => (array) $depends,
|
'depends' => (array) $depends,
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user