我有一个简单的问题要问你。我的网站上有一个付费模板,我想在页面上加载带有异步属性的js文件。
// add scripts
$this['asset']->addFile('js', 'js:uikit.js');
/* $this['asset']->addFile('js','warp:vendor/uikit/js/components/autocomplete.js');
$this['asset']->addFile('js', 'warp:vendor/uikit/js/components/search.js'); */
$this['asset']->addFile('js', 'warp:vendor/uikit/js/components/sticky.js');
/* $this['asset']->addFile('js', 'warp:vendor/uikit/js/components/tooltip.js'); */
$this['asset']->addFile('js', 'js:social.js');
$this['asset']->addFile('js', 'js:theme.js');
// internet explorer
if ($this['useragent']->browser() == 'msie') {
$head[] = sprintf('<!--[if IE 8]><link rel="stylesheet" href="%s"><![endif]-->', $this['path']->url('css:ie8.css'));
$head[] = sprintf('<!--[if IE 9]><link rel="stylesheet" href="%s"><![endif]-->', $this['path']->url('css:ie9.css'));
$head[] = sprintf('<!--[if lte IE 8]><script async src="%s"></script><![endif]-->', $this['path']->url('js:html5.js'));
}
if (isset($head)) {
$this['template']->set('head', implode("\n", $head));
}
和另一个文件:
$warp = require(JPATH_ROOT.'/templates/'.$this->form->getValue('template').'/warp.php');
$warp['system']->document->addScript($warp['path']->url('warp:vendor/jquery/jquery-mustache.js'));
$warp['system']->document->addScript($warp['path']->url('warp:vendor/jquery/jquery-cookie.js'));
$warp['system']->document->addScript($warp['path']->url('warp:vendor/jquery/jquery-less.js'));
$warp['system']->document->addScript($warp['path']->url('warp:vendor/jquery/jquery-rtl.js'));
$warp['system']->document->addScript($warp['path']->url('warp:vendor/spectrum/spectrum.js'));
$warp['system']->document->addScript($warp['path']->url('warp:vendor/uikit/js/uikit.js'));
$warp['system']->document->addScript($warp['path']->url('warp:vendor/less/less.js'));
$warp['system']->document->addScript($warp['path']->url('config:js/config.js'));
$warp['system']->document->addScript($warp['path']->url('config:js/admin.js'));
我应该添加什么来让所有或部分js文件都具有异步属性?
由于