清華大佬耗費三個月吐血整理的幾百G的資源,免費分享!....>>>
生成的Html中先后順序
示例
$this->registerLinkTag(['rel'=>'archives','title'=>'Yii2|Yii愛好者中文社區(qū)門戶','href'=>'2'],'addlink'); $this->registerLinkTag(['rel'=>'archives','title'=>'Yii2|Yii愛好者中文社區(qū)門戶','href'=>'1'],'addlink'); $this->registerMetaTag(['name'=>'generator','content'=>'Discuz! X3.2']); $this->registerMetaTag(['name'=>'author','content'=>'Discuz! Team and Comsenz UI Team']); $cssString='body{margin:0px;padding:0px;}'; $this->registerCss($cssString); $this->registerCssFile('css/site.css'); $jsString='$("#id").height(5)'; $this->registerJs($jsString,View::POS_READY); $this->registerJsFile('assets/35aad32d/gii.js',['depends'=>['yii\web\YiiAsset'],'position'=>View::POS_HEAD]); 依賴項 只有在注冊css文件和js文件的時候才會使用依賴項,主要是為了確保注冊的js在所依賴的js文件之后
$this->registerCssFile('css/site.css'); $this->registerJsFile('assets/35aad32d/gii.js',['depends'=>['yii\web\YiiAsset'],'position'=>View::POS_HEAD]);注冊js代碼、js文件的位置 js代碼的位置有五種
js文件的位置有三種
其中在注冊的時候可以指定js文件的依賴項 |
掃碼二維碼 獲取免費視頻學習資料