diff --git a/docs/components.md b/docs/components.md index b09e694..469f02c 100644 --- a/docs/components.md +++ b/docs/components.md @@ -1,5 +1,3 @@ -# 内置组件 - ## 公共方法 每个组件都可以设置`class`和`style` @@ -10,7 +8,7 @@ style(['width'=>'100px']); ``` ## 展示组件 -### 步骤条 +## Steps 步骤条 引导用户按照流程完成任务的分步导航条,可根据实际应用场景设定步骤,步骤不得少于 2 步。 @@ -52,7 +50,15 @@ Steps::make() Html::make()->html("
......
"); ``` +### Alert警告 + +用于页面中展示重要的提示信息。 + +``` +Alert::make("title","desc"); +``` +属性请查看 https://element.eleme.cn/#/zh-CN/component/alert ## 表格组件 diff --git a/src/Console/stubs/HomeController.stub b/src/Console/stubs/HomeController.stub index eca6fba..a47bc13 100644 --- a/src/Console/stubs/HomeController.stub +++ b/src/Console/stubs/HomeController.stub @@ -2,17 +2,27 @@ namespace DummyNamespace; -use SmallRuralDog\Admin\Components\Text; +use SmallRuralDog\Admin\Components\Alert; use SmallRuralDog\Admin\Controllers\AdminController; use SmallRuralDog\Admin\Layout\Content; +use SmallRuralDog\Admin\Layout\Row; class HomeController extends AdminController { - public function index(Content $content) - { - $content->body(Text::make("欢迎使用!!!")); + public function index(Content $content){ + $content->className('m-10') + ->row(function (Row $row) { + $row->gutter(20); + $row->column(12, Alert::make("你好,同学!!", "欢迎使用 laravel-vue-admin")->showIcon()->closable(false)->type("success")); + $row->column(12, Alert::make("你好,同学!!", "欢迎使用 laravel-vue-admin")->showIcon()->closable(false)->type("error")); + })->row(function (Row $row) { + $row->gutter(20); + $row->className('mt-10'); + $row->column(12, Alert::make("你好,同学!!", "欢迎使用 laravel-vue-admin")->showIcon()->closable(false)->type("info")); + $row->column(12, Alert::make("你好,同学!!", "欢迎使用 laravel-vue-admin")->showIcon()->closable(false)->type("warning")); + }); return $content; } } diff --git a/src/Layout/Content.php b/src/Layout/Content.php index d3f62e7..c1ecde0 100644 --- a/src/Layout/Content.php +++ b/src/Layout/Content.php @@ -28,15 +28,18 @@ public function body($content) } - public function row($content) + public function row($content, $gutter = 0) { if ($content instanceof Closure) { $row = new Row(); + $row->gutter($gutter); call_user_func($content, $row); $this->addRow($row); } else { - $this->addRow(new Row($content)); + $row = new Row(); + $row->gutter($gutter); + $this->addRow($row); } return $this; }