php设置按钮,按钮配置明细

## 添加顶部TopBar按钮

~~~

->addTopBarButton([

'type'=> 'add',

'title'=> '引用项目',

'icon_class'=> 'fa fa-plus-circle',

'href'=> url('getJoinProjectCode'),

'popup'=> true,//弹出框展示内容

'attr'=> ['modal-jumpType'=>1,'modal-wh'=>'450|240'],

])

->addTopBarButton([

'type'=> 'add',

'title'=> '新增项目',

'icon_class'=> 'fa fa-plus',

'href'=> url('addProject'),

'popup'=> true,//弹出框展示内容

'attr'=> ['modal-jumpType'=>1,'modal-wh'=>'450|240'],

])

~~~

![](https://box.kancloud.cn/db2ad7fa38363a6383b8a4f4fdbe2586_1722x237.png)

## 添加顶部按钮

~~~

->addTopButton([

'type'=> 'add',

'icon_class'=> 'fa fa-plus-circle',

'href'=> url('addQuestionBank'),

'popup'=> true,

'attr'=> ['modal-type'=>'sm']

])

->addTopButton([

'type'=> 'custom',

'title'=> '保存分组',

'item_class'=> 'save_sort_list_data',

'icon_class'=> 'fa fa-check',

'href'=> 'javascript:;',

])

// 操作全部需要设置item_class为ajax-post,并增加属性target-form值为ids

->addTopButton([

'title'=> '标记为已读',

'icon_class'=> '',

'item_class'=> 'ajax-post',

'href'=> url('change_read_status'),

'attr'=> ['target-form'=>'ids']

])

~~~

## 添加列表按钮

~~~

->addListButton([

'type'=> 'edit',

'href_base'=> 'editQuestionBank',

'icon_class'=> 'fa fa-pencil',

'popup'=> true,

'attr'=> ['modal-type'=>'sm']

])

~~~

## 默认配置及参数说明

~~~

$default_config = array(

'title'=> '',// 按钮文字名称

'item_class'=> '',// 按钮节点附加class

'append_item_class'=> '',// 在原按钮的样式上追加的class样式

'icon_class'=> '',// 按钮图标class

'href'=> '',// 按钮链接(当指定此值时,其他链接参数无效)

'href_base'=> '',// 链接基础地址

'href_param'=> '',// 链接参数,默认取主键值$this->pk_name

'href_param_key'=> [],// 参与生成链接的key

'attr'=> [],// 按钮附加属性

'popup'=> false,// 弹出框展示内容

'target'=> '_self',// 链接打开方式

'show_map'=> [],// 是否显示按钮配置条件

);

~~~