久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      yii框架怎么引入css與js文件

      yii框架怎么引入css與js文件

      1、可以直接在視圖頁(yè)面上引入

      yii框架怎么引入css與js文件

      2、可以直接寫(xiě)原生代碼引入,路徑是項(xiàng)目目錄/web/css 或者/js

      <script src="js/nav.js"></script>

      相關(guān)教程推薦:yii框架

      3、可以使用assetBundle管理css樣式及js腳本

      資源包定義:basic/assets/AppAsset.php

      <?php/**  * @link http://www.yiiframework.com/  * @copyright Copyright (c) 2008 Yii Software LLC  * @license http://www.yiiframework.com/license/  */  namespace appassets;  use yiiwebAssetBundle;  /**  * @author Qiang Xue <qiang.xue@gmail.com>  * @since 2.0  */class AppAsset extends AssetBundle{     public $basePath = '@webroot';     public $baseUrl = '@web';     public $css = [         'css/site.css',         'css/base.css'     ];     public $js = [         'js/sliders.js'     ];     public $depends = [ //依賴(lài)包,沒(méi)有可以不寫(xiě)         'yiiwebYiiAsset',         'yiibootstrapBootstrapAsset',       ];       //定義按需加載JS方法,注意加載順序在最后       public static function addScript($view, $jsfile) {           $view->registerJsFile($jsfile, [AppAsset::className(), 'depends' => 'apiassetsAppAsset']);       }             //定義按需加載css方法,注意加載順序在最后       public static function addCss($view, $cssfile) {           $view->registerCssFile($cssfile, [AppAsset::className(), 'depends' => 'apiassetsAppAsset']);       }  }

      在視圖文件開(kāi)頭寫(xiě)入:

      <?php use yiihelpersHtml; use appassetsAppAsset;  AppAsset::register($this);  ?>

      到現(xiàn)在為止,我們可以在瀏覽器上測(cè)試,發(fā)現(xiàn)并沒(méi)有引入css和js文件,這里要注意了,我們還需要最后一步:

      在視圖文件中我們要加入一下代碼(注:如果我們使用公共視圖文件,可以加入到公共視圖文件,如果沒(méi)有使用,可以放到單獨(dú)頁(yè)面中)

      yii框架怎么引入css與js文件

      4、不需要在資源包管理器中定義方法,只要在視圖頁(yè)面中直接引入即可

      AppAsset::register($this);   //css定義一樣   $this->registerCssFile('@web/css/font-awesome.min.css',['depends'=>['apiassetsAppAsset']]);       $this->registerJsFile('@web/js/jquery-ui.custom.min.js',['depends'=>['apiassetsAppAsset']]);    //$this->registerJsFile('@web/js/jquery-ui.custom.min.js',['depends'=>['apiassetsAppAsset'],'position'=>$this::POS_HEAD]);

      贊(0)
      分享到: 更多 (0)
      ?
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)