cocos creator 3.4版本 base64怎么转为图片

在2.1版本里的实现如下:
var img = new Image();
if ((base64).startsWith !== undefined && (base64).startsWith(“data:image”)) {
img.src = base64;
} else {
img.src = “data:image/png;base64,” + base64;
}
img.onload = function () {
var texture = new cc.Texture2D();
texture.initWithElement(img);
texture.handleLoadedTexture();
if (callback) callback(texture);
};
但是在3.4版本里,取消了initWithElement方法,上面的实现就不行了。这个该怎么改呢

可以看看这个帖子

已解决,谢谢!

该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。