import QRCode from "qrcode";
interface Options {
    width:number,
}
/**
 * @Description: 获取二维码地址
 * @author：翁庚荣
 * @date 2024/3/19 17:13
 * @param text
 * @param callBack
 * @param options
 */
export const QRcode = (text:string, callBack: (url:string) => void,options:Options = { width:200} ) => {
    if(!text){
        throw 'text不能为空！'
    }
    QRCode.toDataURL(text, { width:options.width}, function (err, url) {
        if (err) throw err
        callBack(url)
    })
}