ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 配置项`primaryKey` > 配置当前查询的主键字段,当行操作项`ajax`未定义参数时,默认使用主键传参。 参数`array|string $field` > 值`string`如:`id` > 值`array`配置联合主键如:`['role_id, 'auth_id']` 示例代码: ~~~ return ViewBuilder::table() ->setPage(true) ->setHideCheckbox(false) ->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']); return $query; }) ->setOrderBy('id DESC') ->setPrimaryKey('id') ->render($this); ~~~