YII的JS处理

原创
2015/02/27 18:56
阅读数 97

1.$this->registerJsFile('@web/other/jquery.autocomplete.min.js',['depends'=>['yii\web\JqueryAsset'],'position'=>yii\web\View::POS_HEAD])
2.$this->registerCssFile('@web/other/jquery.autocomplete.css');

3.$this->registerJs($jsstring)
4.$this->registerCss($cssstring)

此外在在view里临时写些代码段的话这样子 

<?php $this->beginBlock('myjs') ?>

   $("trainclassselect-year").click(function(){

  $(this).hide();

  });

    <?php $this->endBlock() ?>

<?php $this->registerJs($this->blocks['myjs'], \yii\web\View::POS_LOAD); ?>

 

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部