Ext js和cordova插件使用这段代码
console.log(getBgPicture);
正确编码图像。
setBodyStyle('background:url("'+'data:image/jpeg;base64,'+getBgPicture +'") no-repeat center; background-size: cover');
执行时会报错
app.js:1 GET data:image/jpeg net::ERR_INVALID_URL
我试过很多方法。如果有人知道请告诉我。提前致谢
最佳答案
你应该给 setBodyStyle
参数作为带有 camelCase
参数的对象。
this.setBodyStyle({
backgroundImage: "url('data:image/jpeg;base64," + getBgPicture + "')",
backgroundRepeat: "no-repeat",
backgroundSize: "cover",
backgroundPosition: "center"
});
关于javascript - Ext JS 编码的 base64 图片设置为背景 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58327219/