-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2705 from XiaoMi/perf/upload
perf(upload): 代码优化
- Loading branch information
Showing
6 changed files
with
45 additions
and
0 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,6 @@ | ||
--- | ||
"@hi-ui/upload": minor | ||
--- | ||
|
||
perf: 依赖项中增加 @hi-ui/message,否则打包时会将多余代码打进去 | ||
feat: 暴露出单个不同类型的上传组件,支持按需引入,对 Tree Shaking 友好 |
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,5 @@ | ||
--- | ||
"@hi-ui/hiui": patch | ||
--- | ||
|
||
perf(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
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,26 @@ | ||
import React from 'react' | ||
import { NormalUpload, DragUpload, PictureUpload, PictureListUpload, AvatarUpload } from '../src' | ||
|
||
/** | ||
* @title 单个导入,按需引用 | ||
* @desc 建议采用该方式引用,有利用打包时做 Tree Shaking | ||
*/ | ||
export const SingleImport = () => { | ||
return ( | ||
<> | ||
<h1>SingleImport</h1> | ||
<div className="upload-single-import__wrap"> | ||
<NormalUpload | ||
uploadAction="https://jsonplaceholder.typicode.com/posts/" | ||
tips="仅支持 jpg/png 文件,且不超过 500kb" | ||
accept="image/png,image/jpg" | ||
headers={{ name: 'mi' }} | ||
name={'files[]'} | ||
onChange={(file, fileList, response) => { | ||
console.log('upload callback', file, fileList, response) | ||
}} | ||
/> | ||
</div> | ||
</> | ||
) | ||
} |