Skip to content

引入

ts
import { getBase64FromUrl } from 't-comm';

// 不支持 tree-shaking 的项目
import { getBase64FromUrl} from 't-comm/lib/console/index';

// 只支持 ESM 的项目
import { getBase64FromUrl} from 't-comm/es/console/index';

getBase64FromUrl(url)

描述

获取图片,并转 base64

参数

参数名描述
url

图片链接

返回:

获取结果

示例

ts
getBase64FromUrl(imgUrl).then(consoleImage);