如何在YiiBooster 4.x的booster.widgets.TbButtonGroup中使用链接url


How to use link url in booster.widgets.TbButtonGroup of YiiBooster 4.x?

此代码链接不起作用。。。如何修复?

<?php
    $this->widget(
        'booster.widgets.TbButtonGroup', array(
            'context' => 'primary',
            'buttons' => array(
                array('label' => UserModule::t('Manage User'), 'url' => Yii::app()->createUrl('/user/admin'), 'icon'=>'fa fa-users','tooltip'=>'ทดสอบ', 'visible' => UserModule::isAdmin()),
                array('label' => UserModule::t('List User'), 'url' => array('/user'),'icon'=>'fa fa-users'),
                array('label' => UserModule::t('Profile'), 'url' => array('/user/profile'),'icon'=>'fa fa-user'),
                array('label' => UserModule::t('Edit'), 'url' => array('edit'),'icon'=>'fa fa-edit'),
                array('label' => UserModule::t('Change password'), 'url' => array('changepassword'),'icon'=>'fa fa-pencil'),
                array('label' => UserModule::t('Logout'), 'url' => array('/user/logout'),'icon'=>'fa fa-sign-out')
            ),
        )
    );
    ?>

这是输出。。它不是显示链接。。。

<div class="btn-group"><button class="btn btn-primary" id="yw0" data-toggle="tooltip" name="yt0" type="button"><i class="fa fa-users"></i> จัดการผู้ใช้งาน</button><button class="btn btn-primary" id="yw1" name="yt1" type="button"><i class="fa fa-users"></i> รายการผู้ใช้งาน</button><button class="btn btn-primary" id="yw2" name="yt2" type="button"><i class="fa fa-user"></i> โพรไฟล์</button><button class="btn btn-primary" id="yw3" name="yt3" type="button"><i class="fa fa-edit"></i> แก้ไข</button><button class="btn btn-primary" id="yw4" name="yt4" type="button"><i class="fa fa-pencil"></i> เปลี่ยนรหัสผ่าน</button><button class="btn btn-primary" id="yw5" name="yt5" type="button"><i class="fa fa-sign-out"></i> ออกจากระบบ</button></div>

您需要指定需要的按钮类型

托盘这个:

Yii::import('booster.widgets.TbButton');
$this->widget(
    'booster.widgets.TbButtonGroup',
            [
                'buttons' => [
                    [
                        'label' => 'Descargar',
                        'buttonType'=> TbButton::BUTTON_LINK,
                        'icon'=>'fa fa-download',  
                        'url' => Yii::app()->baseUrl,
                    ],
                    [
                        'label' => 'Editar', 
                        'buttonType'=> TbButton::BUTTON_LINK,
                        'icon'=>'fa fa-pencil', 
                        'url' => Yii::app()->baseUrl,
                    ],
                ],
            ]
        );

url参数应该是字符串,而不是数组。

因此,不是
array('label' => UserModule::t('List User'), 'url' => array('/user'),'icon'=>'fa fa-users')

尝试使用
array('label' => UserModule::t('List User'), 'url' => '/user', 'icon'=>'fa fa-users')

如果它不起作用,那么很可能有些组件没有加载或JavaScript被禁用。

如果你提供URL,我可以在那里看到有问题的页面,我将能够帮助你更多。