【问题标题】:Ext JS Encoded base64 image set as background urlExt JS 编码 base64 图像设置为背景 url
【发布时间】:2019-10-10 16:17:52
【问题描述】:

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

我尝试了很多方法。如果有人知道,请告诉我。提前致谢

【问题讨论】:

    标签: javascript css cordova extjs encode


    【解决方案1】:

    您应该将参数作为带有camelCase 参数的对象提供给setBodyStyle

    this.setBodyStyle({
        backgroundImage: "url('data:image/jpeg;base64," + getBgPicture + "')",
        backgroundRepeat: "no-repeat",
        backgroundSize: "cover",
        backgroundPosition: "center"
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-10
      • 2018-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-13
      • 1970-01-01
      • 2021-03-14
      相关资源
      最近更新 更多