Skip to content

Commit

Permalink
更新组件文档
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallRuralDog committed Mar 30, 2020
1 parent 1646841 commit db39b71
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
12 changes: 9 additions & 3 deletions docs/components.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# 内置组件

## 公共方法

每个组件都可以设置`class``style`
Expand All @@ -10,7 +8,7 @@ style(['width'=>'100px']);
```
## 展示组件

### 步骤条
## Steps 步骤条

引导用户按照流程完成任务的分步导航条,可根据实际应用场景设定步骤,步骤不得少于 2 步。

Expand Down Expand Up @@ -52,7 +50,15 @@ Steps::make()
Html::make()->html("<div>......</div>");
```

### Alert警告

用于页面中展示重要的提示信息。

```
Alert::make("title","desc");
```

属性请查看 https://element.eleme.cn/#/zh-CN/component/alert

## 表格组件

Expand Down
18 changes: 14 additions & 4 deletions src/Console/stubs/HomeController.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/Layout/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit db39b71

Please sign in to comment.