Skip to content

Commit 3540459

Browse files
committed
添加隐藏Form tabs方法
1 parent 8d57134 commit 3540459

File tree

9 files changed

+54
-16
lines changed

9 files changed

+54
-16
lines changed

docs/components.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,22 @@ Transfer::make()->data($permissionModel::get()->map(function ($item) {
641641
}))->titles(['可授权', '已授权'])->filterable()
642642
```
643643

644+
### WangEditor
645+
646+
轻量级 web 富文本编辑器
647+
648+
```php
649+
WangEditor::make()
650+
->menus([])
651+
->zIndex(999)
652+
->uploadImgShowBase64(true)
653+
->uploadImgServer("")
654+
->uploadFileName("file")
655+
->uploadImgHeaders(['xx'=>'xx']);
656+
```
657+
658+
659+
644660

645661

646662
## 统计图表

docs/form.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ $form->disabled(true);
117117

118118
```php
119119
$form->item('username', '用户名')->tab("用户信息");
120+
//注意,要开启tab,必须设置
121+
$form->hideTab(false);
120122
```
121123

122124

public/app.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,12 @@ __webpack_require__.r(__webpack_exports__);
979979
//
980980
//
981981
//
982+
//
983+
//
984+
//
985+
//
986+
//
987+
//
982988

983989

984990

@@ -29138,11 +29144,12 @@ var render = function() {
2913829144
},
2913929145
[
2914029146
_c(
29141-
"el-tabs",
29147+
_vm.attrs.attrs.hideTab ? "div" : "el-tabs",
29148+
{ tag: "component" },
2914229149
_vm._l(_vm.attrs.tabs, function(tab) {
2914329150
return _c(
29144-
"el-tab-pane",
29145-
{ key: tab, attrs: { label: tab } },
29151+
_vm.attrs.attrs.hideTab ? "div" : "el-tab-pane",
29152+
{ key: tab, tag: "component", attrs: { label: tab } },
2914629153
[
2914729154
_vm._l(_vm.attrs.formItems, function(item, index) {
2914829155
return [

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=df62937f41197140ffc5",
2+
"/app.js": "/app.js?id=00ab9777d40892d1144c",
33
"/manifest.js": "/manifest.js?id=af490cb90066598b3f0e",
44
"/vendor.js": "/vendor.js?id=0651917a3e4f144a9e23"
55
}

resources/js/components/form/Form.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@
2020
:size="attrs.attrs.size"
2121
:disabled="attrs.attrs.disabled"
2222
>
23-
<el-tabs>
24-
<el-tab-pane :label="tab" v-for="tab in attrs.tabs" :key="tab">
25-
<template v-for="(item, index) in attrs.formItems" >
23+
<component :is="attrs.attrs.hideTab ? 'div' : 'el-tabs'">
24+
25+
<component
26+
:is="attrs.attrs.hideTab ? 'div' : 'el-tab-pane'"
27+
:label="tab"
28+
v-for="tab in attrs.tabs"
29+
:key="tab"
30+
>
31+
<template v-for="(item, index) in attrs.formItems">
2632
<ItemIf
27-
v-if='tab == item.tab'
33+
v-if="tab == item.tab"
2834
:key="index"
2935
:form_item="item"
3036
:form_items="attrs.formItems"
@@ -84,8 +90,8 @@
8490
/>
8591
</ItemIf>
8692
</template>
87-
</el-tab-pane>
88-
</el-tabs>
93+
</component>
94+
</component>
8995
<div class="form-bottom-actions">
9096
<div></div>
9197
<div>

src/Components/Form/WangEditor.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function uploadImgShowBase64(bool $uploadImgShowBase64 = true)
8787
* @param string $uploadImgServer
8888
* @return $this
8989
*/
90-
public function uploadImgServer($uploadImgServer)
90+
public function uploadImgServer(string $uploadImgServer)
9191
{
9292
$this->uploadImgServer = $uploadImgServer;
9393
return $this;
@@ -98,24 +98,22 @@ public function uploadImgServer($uploadImgServer)
9898
* @param mixed $uploadFileName
9999
* @return WangEditor
100100
*/
101-
public function uploadFileName($uploadFileName)
101+
public function uploadFileName(string $uploadFileName)
102102
{
103103
$this->uploadFileName = $uploadFileName;
104104
return $this;
105105
}
106106

107107
/**
108+
* 自定义 header
108109
* @param mixed $uploadImgHeaders
109110
* @return WangEditor
110111
*/
111-
public function uploadImgHeaders($uploadImgHeaders)
112+
public function uploadImgHeaders(array $uploadImgHeaders)
112113
{
113114
$this->uploadImgHeaders = $uploadImgHeaders;
114115
return $this;
115116
}
116117

117118

118-
119-
120-
121119
}

src/Controllers/PermissionController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ protected function form()
5656
$form = new Form(new $permissionModel());
5757

5858

59+
5960
$form->item('slug', "标识")->required();
6061
$form->item('name', "名称")->required();
6162
$form->item('http_method', "请求方式")

src/Form/FormAttrs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ class FormAttrs
2121
public $size="small";
2222
public $disabled = false;
2323

24+
public $hideTab = true;
25+
2426
}

src/Form/TraitFormAttrs.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,10 @@ public function disabled(bool $disabled = true)
156156
$this->attrs->disabled = $disabled;
157157
return $this;
158158
}
159+
160+
public function hideTab(bool $hideTab = true)
161+
{
162+
$this->attrs->hideTab = $hideTab;
163+
return $this;
164+
}
159165
}

0 commit comments

Comments
 (0)