这是我的代码:
exports.generate_qr = function(value) {
var urlQR;
QRCode.toDataURL(value, { scale: 10, errorCorrectionLevel: 'M' }, function (err, url) {
urlQR = url;
});
return urlQR;
};
然后我打电话给
var url = exports.generate_qr("Hello World!");
console.log(url);
但只返回 undefined