-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(uplaod): add onImageClick * fix: import path * docs: onFail type definition * fix: cnpm package install failed * refactor: update typescript version * chore: lock @swc/core to 1.3.6
- Loading branch information
Showing
8 changed files
with
16,518 additions
and
18,644 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"ossaui": patch | ||
"ossa-demo": patch | ||
"ossa-doc": patch | ||
--- | ||
|
||
add onImageClick for upload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,51 @@ | ||
--- | ||
sidebar_position: 32 | ||
demo_url: 'https://neteaseyanxuan.github.io/OSSA/#/components/upload/demo/index' | ||
demo_url: "https://neteaseyanxuan.github.io/OSSA/#/components/upload/demo/index" | ||
--- | ||
|
||
# Upload 图片上传 | ||
|
||
## 介绍 | ||
|
||
图片上传组件,用于选择图片 | ||
|
||
## 用法 | ||
|
||
### 普通 | ||
|
||
```jsx | ||
<OsUpload | ||
onChange={(file, operationType, index) => onChange(file,operationType, index)} | ||
onChange={(file, operationType, index) => | ||
onChange(file, operationType, index) | ||
} | ||
onFail={(data) => onFail(data)} | ||
></OsUpload> | ||
``` | ||
|
||
|
||
|
||
## API | ||
|
||
### 属性 | ||
|参数|说明|类型|默认值| | ||
|------|------|------|------| | ||
|max|最大数量,可选|number|infinity| | ||
|multiple|开始多张传输,可选|boolean|true| | ||
|customStyle|自定义样式,可选|object|-| | ||
|className|自定义类名,可选|string|-| | ||
|
||
| 参数 | 说明 | 类型 | 默认值 | | ||
| ----------- | ------------------ | ------- | -------- | | ||
| max | 最大数量,可选 | number | infinity | | ||
| multiple | 开始多张传输,可选 | boolean | true | | ||
| customStyle | 自定义样式,可选 | CSSProperties | - | | ||
| className | 自定义类名,可选 | string | - | | ||
|
||
### 方法 | ||
|函数名|说明|参数| | ||
|------|------|------| | ||
|onChange|上传成功回调\(此时可自行将图片上传至服务器\)|\(files: Array, operationType: string, index: number\) =\> void\(注:index在operationType为remove时有效| | ||
|onFail|上传失败触发|\(data: object\) =\> void| | ||
|
||
| 函数名 | 说明 | 参数 | | ||
| ------------ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | ||
| onChange | 上传成功回调\(此时可自行将图片上传至服务器\) | \(files: ImageFile[], operationType: string, index: number\) =\> void\(注:index 在 operationType 为 remove 时有效 | | ||
| onImageClick | 图片列表点击回调 | (index: number, file: ImageFile) => void | | ||
| onFail | 上传失败触发 | \(err: TaroGeneral.CallbackResult\) =\> void | | ||
|
||
#### ImageFile | ||
|
||
| 参数 | 类型 | 必填 | 说明 | | ||
| --------------- | ------ | ---- | -------------------------------------- | | ||
| path | string | 是 | 本地临时文件路径 | | ||
| size | number | 是 | 本地临时文件大小,单位 B | | ||
| type | string | 否 | 文件的 MIME 类型, API 支持度: h5 | | ||
| originalFileObj | File | 否 | 原始的浏览器 File 对象, API 支持度: h5 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
56c33bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ossa-doc – ./
ossa-doc.vercel.app
ossa-doc-ossa.vercel.app
ossa-doc-git-main-ossa.vercel.app
ossa.miaode.com
56c33bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ossa-demo – ./
ossaui.vercel.app
ossa-demo-ossa.vercel.app
ossa-demo-git-main-ossa.vercel.app