Skip to content

Commit db39b71

Browse files
committed
更新组件文档
1 parent 1646841 commit db39b71

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

docs/components.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# 内置组件
2-
31
## 公共方法
42

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

13-
### 步骤条
11+
## Steps 步骤条
1412

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

@@ -52,7 +50,15 @@ Steps::make()
5250
Html::make()->html("<div>......</div>");
5351
```
5452

53+
### Alert警告
54+
55+
用于页面中展示重要的提示信息。
56+
57+
```
58+
Alert::make("title","desc");
59+
```
5560

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

5763
## 表格组件
5864

src/Console/stubs/HomeController.stub

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,27 @@
22

33
namespace DummyNamespace;
44

5-
use SmallRuralDog\Admin\Components\Text;
5+
use SmallRuralDog\Admin\Components\Alert;
66
use SmallRuralDog\Admin\Controllers\AdminController;
77
use SmallRuralDog\Admin\Layout\Content;
8+
use SmallRuralDog\Admin\Layout\Row;
89

910
class HomeController extends AdminController
1011
{
1112

1213

13-
public function index(Content $content)
14-
{
15-
$content->body(Text::make("欢迎使用!!!"));
14+
public function index(Content $content){
15+
$content->className('m-10')
16+
->row(function (Row $row) {
17+
$row->gutter(20);
18+
$row->column(12, Alert::make("你好,同学!!", "欢迎使用 laravel-vue-admin")->showIcon()->closable(false)->type("success"));
19+
$row->column(12, Alert::make("你好,同学!!", "欢迎使用 laravel-vue-admin")->showIcon()->closable(false)->type("error"));
20+
})->row(function (Row $row) {
21+
$row->gutter(20);
22+
$row->className('mt-10');
23+
$row->column(12, Alert::make("你好,同学!!", "欢迎使用 laravel-vue-admin")->showIcon()->closable(false)->type("info"));
24+
$row->column(12, Alert::make("你好,同学!!", "欢迎使用 laravel-vue-admin")->showIcon()->closable(false)->type("warning"));
25+
});
1626
return $content;
1727
}
1828
}

src/Layout/Content.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@ public function body($content)
2828
}
2929

3030

31-
public function row($content)
31+
public function row($content, $gutter = 0)
3232
{
3333

3434
if ($content instanceof Closure) {
3535
$row = new Row();
36+
$row->gutter($gutter);
3637
call_user_func($content, $row);
3738
$this->addRow($row);
3839
} else {
39-
$this->addRow(new Row($content));
40+
$row = new Row();
41+
$row->gutter($gutter);
42+
$this->addRow($row);
4043
}
4144
return $this;
4245
}

0 commit comments

Comments
 (0)