yii2 registering JS files to a View

前端 未结 5 1349
慢半拍i
慢半拍i 2021-02-05 07:34

I have A.php view file in /views/A/ folder. And I have A.js js file in /views/A/ folder Please help me register js file in view file.

As I unde

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 08:13

    A: From the docs: http://www.yiiframework.com/doc-2.0/yii-web-view.html Your code seem correct.

    Do you register the js from the view file itself? not the controller? The registerJsFile() method is from the view class.

    Its highly possible that your IDE is not finding the method, have you tried it in a apache enviroment?

    B: Use a alias

提交回复
热议问题