企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 配置项`toolbarExport` > 配置工具栏导出按钮 #### 参数`arrau $options 选项` > -`title string 按钮名称,默认:` > -`icon string 按钮图标,默认: glyphicon glyphicon-export` > -`heads 自定义头部` * ['ID', '用户名', '邮箱', '电话'] > -`fields 自定义字段; 如果没定义则使用列表字段` * ['id', 'username', 'email', 'an', 'mobile'] > -`columns 自定义列` ~~~ [ 'id', 'username', 'email', 'mobile' => function ($item) { return '+' . $item['an'] . ' ' . $item['mobile']; }, ], ~~~ 示例代码: ~~~ return ViewBuilder::table() ->setTitle('会员列表') ->setPage(true) ->setHideCheckbox(false) ->setToolbarRefresh() ->setToolbarExport([ 'icon' => '', 'name' => '会员列表', 'heads' => ['ID', '用户名', '邮箱', '电话'], 'fields' => ['id', 'username', 'email', 'an', 'mobile'], 'columns' => [ 'id', 'username', 'email', 'mobile' => function ($item) { return '+' . $item['an'] . ' ' . $item['mobile']; }, ], ]) ->setColumns([ 'password', 'username' => table_column_helper('用户名', ['style' => ['min-width' => '100px']]), 'an_mobile' => table_column_helper('电话', ['style' => ['min-width' => '100px']], function ($item) { return '+' . $item['an'] . ' ' . $item['mobile']; }), 'email' => table_column_helper('邮箱', ['style' => ['min-width' => '200px']]), ]) ->setQuery(function () { $query = AdminUser::find()->select(['id', 'username', 'password', 'email', 'an', 'mobile', 'status']); return $query; }) ->setOrderBy('id DESC') ->setPrimaryKey('id') ->render($this); ~~~ 示例图示: ![](https://img.kancloud.cn/5e/db/5edbc2279032b7b5ce69bd33f5750d0d_1693x932.png) ![](https://img.kancloud.cn/dc/66/dc66dc6f64cd0d124345f692876c4d08_1673x881.png) ![](https://img.kancloud.cn/38/95/38959651607ac64b211887f84ece55bd_807x970.png)