RegisterPackage depends on RegisterScriptFile

后端 未结 2 1232
一个人的身影
一个人的身影 2021-01-19 09:06

I have a package that requires Google Map library. And I implemented it like this in the view.

clientScript->registerScriptFile(\'         


        
2条回答
  •  伪装坚强ぢ
    2021-01-19 09:33

    registerPackage() method don't have the any option to decide its position but you can decide position of registerScriptfile() like this ...

    public CClientScript registerScript(string $id, string $script, integer $position=4)
    

    $position integer the position of the JavaScript code. Valid values include the following: CClientScript::POS_HEAD : the script is inserted in the head section right before the title element. CClientScript::POS_BEGIN : the script is inserted at the beginning of the body section. CClientScript::POS_END : the script is inserted at the end of the body section. CClientScript::POS_LOAD : the script is inserted in the window.onload() function. CClientScript::POS_READY : the script is inserted in the jQuery's ready function.

提交回复
热议问题