如何在Yii中使用NLSClientScript扩展?

如何在Yii中使用NLSClientScript扩展?,yii,yii-extensions,Yii,Yii Extensions,如何使用分机 我试过这个: config/main.php: 'clientScript' => array( 'class' => 'ext.NLSClientScript', $cs = Yii::app()->getClientScript(); $systemJsPath = Yii::app()->getAssetManager()->publish( Yii::getPathOfAlias('system.web.js' ), false,

如何使用分机

我试过这个:

config/main.php:

'clientScript' => array( 
'class' => 'ext.NLSClientScript',
$cs = Yii::app()->getClientScript();
$systemJsPath = Yii::app()->getAssetManager()->publish(
     Yii::getPathOfAlias('system.web.js' ), false, -1, false );
$cs->registerScriptFile('jquery');
$cs->registerScriptFile( $systemJsPath . '/custom.js');
$cs->registerScriptFile( $systemJsPath . '/ext/plugins/jquery.form.js');
views/layouts/main.php:

'clientScript' => array( 
'class' => 'ext.NLSClientScript',
$cs = Yii::app()->getClientScript();
$systemJsPath = Yii::app()->getAssetManager()->publish(
     Yii::getPathOfAlias('system.web.js' ), false, -1, false );
$cs->registerScriptFile('jquery');
$cs->registerScriptFile( $systemJsPath . '/custom.js');
$cs->registerScriptFile( $systemJsPath . '/ext/plugins/jquery.form.js');

但它不起作用。jQuery未加载。

jQuery在Yii中被称为核心脚本,应该使用注册

在您的示例中:

$cs->registerCoreScript('jquery');
所有核心脚本的简短名称都列在
YII_PATH/web/js/packages.php