昨天在vue.js項目中,產生彩色二維碼,並顯示出來。
如這個樣子:
敢用手機掃一掃? 哈哈,這個二維碼只是本博客http://insus.cnblogs.com鏈接而已。
代碼簡單:

<div id="test"> <img :src="'data:image/png;base64,'+ qrcode"/> </div>

var vue_content = new Vue({ el: '#test', data() { return { qrcode: null } }, mounted() { axios .get('/api/BC/GetColorQrCode') .then(response => ( this.qrcode = response.data) ) .catch(function (error) { console.log(error); }); } })