Skip to content

Commit 05a1c1e

Browse files
committed
修复上传组件一对多
1 parent a37d3b8 commit 05a1c1e

File tree

8 files changed

+492
-78
lines changed

8 files changed

+492
-78
lines changed

docs/components.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ Icon::make()
139139

140140
#### 基础用法
141141

142+
模型导入`ModelTree`
143+
142144
```php
143145
<?php
144146

@@ -158,10 +160,18 @@ class GoodsClass extends Model
158160
}
159161
```
160162

163+
使用demo
164+
165+
`goods_class_path` 需要设置成json类型
161166

167+
```php
168+
protected $casts = [
169+
"goods_class_path" => "json"
170+
];
171+
```
162172

163173
```php
164-
$form->item("goods_class_id", "产品分类")->displayComponent(function () {
174+
$form->item("goods_class_path", "产品分类")->displayComponent(function () {
165175
$goods_class = new GoodsClass();
166176
$allNodes = $goods_class->toTree();
167177
return Cascader::make()->options($allNodes)->value("id")->label("name")->expandTrigger("hover");
@@ -206,8 +216,8 @@ $form->item('avatar', '头像')->displayComponent(function(){
206216
支持多个文件上传,数据格式为数组
207217
```php
208218
Upload::make()->multiple();
209-
//如果是一对多情况下,并且是对象数组,需要指定文件路径的字段
210-
Upload::make()->multiple(true,"keyName");
219+
//如果是一对多情况下,并且是对象数组,需要指定文件组件,文件路径字段
220+
Upload::make()->multiple(true,"keyName","valueName");
211221
```
212222
#### 上传附加数据
213223
```php

package-lock.json

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"wangeditor": "^3.1.1"
3535
},
3636
"dependencies": {
37+
"awe-dnd": "^0.3.4",
3738
"url-loader": "^3.0.0"
3839
}
3940
}

0 commit comments

Comments
 (0)