0

我在简单项目 yii 中使用扩展助推器,我认为助推器在 yii 项目中存在冲突,我可以在我的项目中添加助推器,但浏览器控制台中的所有页面都有错误:
例如,过滤器的 CGridview 不起作用或其他我的jquery 所有者功能也不起作用。
Firefox 控制台中的错误:

TypeError: jQuery(...).popover 不是函数

jQuery('[data-toggle=popover]').popover();

chorom 控制台中的错误: 在此处输入图像描述

如何解决我的问题,我只添加了一个 jquery(版本 9)。

4

1 回答 1

4

我对那些给出负面不合理的人感到抱歉。
有一些解决步骤:
1-删除默认的yii jquery。
2- 添加新的 jquery top of 9 版本。
但你不应该向 header.php 添加新的 jquery。
您必须将 jquery 添加到 config/main.php 并进行其他配置。

主文件

 'components' => array(
...
'clientScript' => array(
        'scriptMap' => array(
            'jquery.js'=>false,  //disable default implementation of jquery
            'jquery.min.js'=>false,  //desable any others default implementation
            'core.css'=>false, //disable
            'styles.css'=>false,  //disable
            'pager.css'=>false,   //disable
            'default.css'=>false,  //disable
        ),
        'packages'=>array(
            'jquery'=>array(                             // set the new jquery
                'baseUrl'=>'js/',
                'js'=>array('jquery9.js'),
            ),
            'bootstrap'=>array(                       //set others js libraries
                'baseUrl'=>'bootstrap/',
                'js'=>array('js/bootstrap.min.js'),
                'css'=>array(                        // and css
                    'css/bootstrap.min.css',
                    'css/custom.css',
                    'css/bootstrap-responsive.min.css',
                ),
                'depends'=>array('jquery'),         // cause load jquery before load this.
            ),
        ),
    ),

...
),

它使 jquery9 置于其余 jquery 文件之上。

 'depends'=>array('jquery'),         // cause load jquery before load this.
于 2014-09-10T07:15:46.807 回答