【发布时间】:2016-03-16 13:48:03
【问题描述】:
我有一个空的 Yii2 项目。我需要将谷歌地图设置到指定页面。我知道我必须包含我的 .js 和 .css 文件,但我不知道具体如何。我尝试在 assets/AppAsset.php 中设置我的脚本:
public $css = [
'css/site.css',
'css/mystyles.css'
];
public $js = [
'js/map-options.js',
'js/data.json',
'js/markerclusterer.js'
];
并在视图文件和控制器中添加这些行
// in view
$this->registerJsFile('path/to/myfile');
$this->registerCssFile('path/to/myfile');
// in controller
$this->view->registerJsFile('path/to/myfile');
$this->view->registerCssFile('path/to/myfile');
但它仍然不起作用。求助,怎么解决?
【问题讨论】:
标签: javascript php css google-maps yii2