src中的路径 是请求后台生成二维码的接口路径 ...">
const qr_image = require("qr-image");
app.get("/qrcode/txt", async (req, res, next) => { const temp_qrcode = qr_image.image(req.query.text); res.type("png"); temp_qrcode.pipe(res); });
<img id="codeimg" src="http://localhost/qrcode/txt?text=http://www.baidu.com" width="160" height="160" />
原文:https://www.cnblogs.com/MrLee/p/9588976.html