字符串与base64相互转化
// btoa():字符串或二进制值转为Base64编码
// atob():Base64编码转为原来的编码
// 字符串转base64
export function baseToa(str) {
// 对字符串进行编码
var encode = encodeURI(str)
// 对编码的字符串转化base64
var base64 = btoa(encode)
return base64
}
// base64转字符串
export function strTob(base64) {
// 对base64转编码
var decode = atob(base64)
// 编码转字符串
var str = decodeURI(decode)
return str
}