backup code

This commit is contained in:
chuan_wuhao 2022-08-12 18:18:15 +08:00
parent ade081b70a
commit e14d42d75c
3 changed files with 32 additions and 1 deletions

2
.env.test Normal file
View File

@ -0,0 +1,2 @@
#测试环境
NODE_ENV = 'test'

View File

@ -2,6 +2,7 @@ import HmacSHA256 from 'crypto-js/hmac-sha256'
import SHA256 from 'crypto-js/sha256'
import AES from 'crypto-js/aes'
import MD5 from 'crypto-js/md5'
import BASE64 from 'crypto-js/enc-base64'
/**
*
@ -89,3 +90,31 @@ export const useMD5 = (message: WordArray | string, cfg?: object) => {
resolve(cry)
})
}
/**
*
* @param wordArray base64
*
* base64
*/
export const useBase64Stringify = (wordArray: WordArray) => {
return new Promise((resolve) => {
const cry = BASE64.stringify(wordArray)
resolve(cry)
})
}
/**
*
* @param str base64
*
* base64
*/
export const useBase64Parse = (str: string) => {
return new Promise((resolve) => {
const cry = BASE64.parse(str)
resolve(cry)
})
}

View File

@ -152,7 +152,7 @@ export const useViteBuildPlugin = (options?: BuildOptions) => {
const defaultPlugin: BuildOptions = {
outDir: 'dist', // 打包后文件输出路径
assetsDir: 'assets', // 指定静态资源存放路径
assetsInlineLimit: 4096,
assetsInlineLimit: 4096, // 小于这个数字(字节)的静态资产文件将被内联为(base64)
cssCodeSplit: true, // 拆分css代码
minify: 'esbuild', // 指定使用混淆器(terser|esbuild)
sourcemap: false,