Skip to content

Commit

Permalink
fix(base64 demo): fix base64 demo input error
Browse files Browse the repository at this point in the history
  • Loading branch information
innocces committed Jun 29, 2021
1 parent 64811f9 commit 7ef432c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/app/src/pages/useBase64ToArrayBuffer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import './index.less';

export default () => {
const [base64, setBase64] = useState('');
const [inputValue, setInputValue] = useState('');
const buffer = useBase64ToArrayBuffer(base64);

const translateArrayBuffer = useCallback((value) => {
const arrayBuffer = encode(value);
setBase64(arrayBuffer);
console.log(arrayBuffer, useBase64ToArrayBuffer(arrayBuffer));
setInputValue(value);
return value;
}, []);

return (
Expand All @@ -30,8 +32,9 @@ export default () => {
<AtInput
title="待转换文本"
type="text"
value={inputValue}
placeholder="此处输入文本会自动转换为base64"
onChange={(value) => translateArrayBuffer(value)}
onChange={translateArrayBuffer}
/>
<View className="at-article__p">当前转换值base64为: </View>
<View className="at-article__p use-base64-to-array-buffer">
Expand Down

0 comments on commit 7ef432c

Please # to comment.