Yii2 - Include JS Script Only For Specific View

后端 未结 3 2356
醉梦人生
醉梦人生 2021-02-20 09:07

I want to include my js script specific.js for a specific view having action id specific-action-id. I don\'t want the specific.js to be in

3条回答
  •  醉梦人生
    2021-02-20 09:19

    You should simply register this js file in your view, e.g. :

    $this->registerJsFile('@web/js/specific.js');
    

    Read more : http://www.yiiframework.com/doc-2.0/guide-output-client-scripts.html#registering-scripts

提交回复
热议问题