creator里面使用base64生成图片
setQRView(){
let sqr = 'iVBOR。。。QmCC';
this.setQRCode(sqr);
}
// 设置充值二维码
setQRCode(strQR){
let strImg = "data:image/jpeg;base64," + strQR;
let img = new Image();
img.src = strImg
let texture = new cc.Texture2D();
texture.initWithElement(img);
texture.handleLoadedTexture();
this.aSprite.spriteFrame = new cc.SpriteFrame(texture);
}
即可生成一张base64格式的图片了!