🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
案例一: ~~~ public function overview() { $data = [ 'interface_num' => db('api_record')->count(), 'interface_group_num' => db('api_group')->count(), 'error_code_num' => db('api_error_code')->count(), 'error_code_group_num' => db('api_error_code_group')->count(), ]; $builder = TBuilder('custom',$this) ->layoutView('layout_simple') ->row() ->col(3)->addTile(['bg_class'=>'success','icon_class'=>'fa fa-group','value'=>$data['interface_group_num'],'unit'=>'组','text'=>'接口分组']) ->col(3)->addTile(['bg_class'=>'system','icon_class'=>'fa fa-code','value'=>$data['interface_num'],'unit'=>'个','text'=>'接口']) ->col(3)->addTile(['bg_class'=>'danger','icon_class'=>'fa fa-warning','value'=>$data['error_code_num'],'unit'=>'个','text'=>'错误码']) ->col(3)->addTile(['bg_class'=>'warning','icon_class'=>'fa fa-folder-o','value'=>$data['error_code_group_num'],'unit'=>'组','text'=>'错误码组']) ->row(); return $builder->fetch(); } ~~~ ![](https://box.kancloud.cn/36429c533de9c37fff39014953618588_1685x294.png) 案例二(在模态框中打开): ~~~ public function detail($id) { $info = model('ActionLog')->where('id',$id)->find(); $html = '<p>'.$info['remark'].'</p><p class="text-right">'.$info['create_time'].'</p>'; return TBuilder('custom',$this) ->layoutView('layout_simple') ->row() ->col(12)->addHtml($html) ->fetch(); } ~~~ ![](https://box.kancloud.cn/bacc29216c84d012d83a7e7e55f84d48_635x293.png) 案例三(使用 setCustomView 方法指定子模版文件): ~~~ return TBuilder('custom',$this) ->setCustomView( 'sendNotifications' ) ->layoutView('layout_simple') ->fetch(); ~~~