-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82e53b4
commit 09b4052
Showing
7 changed files
with
80 additions
and
43 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
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,5 +1,9 @@ | ||
# @pear-rec/web | ||
|
||
## 1.3.10 | ||
|
||
feat: 图片编辑增加上传图片 | ||
|
||
## 1.3.9 | ||
|
||
feat: 修改GIF | ||
|
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,34 +1,35 @@ | ||
import React, { useImperativeHandle, useRef, forwardRef } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { Space, Button } from "antd"; | ||
import React, { useImperativeHandle, useRef, forwardRef } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Space, Button } from 'antd'; | ||
|
||
function UploadImg(props) { | ||
const { t } = useTranslation(); | ||
const inputRef = useRef(null); | ||
const { t } = useTranslation(); | ||
const { className, style, children } = props; | ||
const inputRef = useRef(null); | ||
|
||
function handleUpload() { | ||
inputRef.current.click(); | ||
} | ||
function handleUpload() { | ||
inputRef.current.click(); | ||
} | ||
|
||
function handleUploadImg(event) { | ||
const files = event.target.files; | ||
props.handleUploadImg(files); | ||
} | ||
function handleUploadImg(event) { | ||
const files = event.target.files; | ||
props.handleUploadImg(files); | ||
} | ||
|
||
return ( | ||
<Space> | ||
<Button type="primary" onClick={handleUpload}> | ||
图片 | ||
</Button> | ||
<input | ||
type="file" | ||
accept="image/png,image/jpeg,.webp" | ||
className="inputRef hide" | ||
ref={inputRef} | ||
onChange={handleUploadImg} | ||
/> | ||
</Space> | ||
); | ||
return ( | ||
<Space className={...className} style={...style}> | ||
<Button type="primary" onClick={handleUpload}> | ||
{children || '图片'} | ||
</Button> | ||
<input | ||
type="file" | ||
accept="image/png,image/jpeg,.webp" | ||
className="inputRef hide" | ||
ref={inputRef} | ||
onChange={handleUploadImg} | ||
/> | ||
</Space> | ||
); | ||
} | ||
|
||
export default UploadImg; |
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,12 +1,17 @@ | ||
.container { | ||
height: 100vh; | ||
width: 100%; | ||
position: relative; | ||
:global { | ||
.save { | ||
position: absolute; | ||
right: 50px; | ||
top: 10px; | ||
} | ||
} | ||
height: 100vh; | ||
width: 100%; | ||
position: relative; | ||
:global { | ||
.upload { | ||
position: absolute; | ||
left: 50px; | ||
top: 10px; | ||
} | ||
.save { | ||
position: absolute; | ||
right: 50px; | ||
top: 10px; | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
.openFolder { | ||
color: #1677ff; | ||
cursor: pointer; | ||
margin-left: 10px; | ||
} | ||
} | ||
} | ||
|