您当前的位置: 首页 >  react native

ITKEY_

暂无认证

  • 0浏览

    0关注

    732博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

react native中使用base64加密解密

ITKEY_ 发布时间:2021-06-24 09:55:10 ,浏览量:0

使用方法

考虑使用与和兼容的base-64,在 react 和 react native 中对我有用:btoaatob

npm install base-64 --save

或者使用yarn

yarn add base-64
import {decode as base64_decode, encode as base64_encode} from 'base-64';
let encoded = base64_encode('YOUR_DECODED_STRING');
let decoded = base64_decode('YOUR_ENCODED_STRING');

如果您正在使用打字稿,请不要忘记安装类型以及npm i --save-dev @types/base-64开发依赖项。 或者yarn 安装:

yarn add  @types/base-64 --dev
参考

https://stackoverflow.com/questions/44458874/how-to-base64-encode-inputs-in-react/44458974

关注
打赏
1665243900
查看更多评论
立即登录/注册

微信扫码登录

0.0377s