sencha touch ::将背景图像添加到Panel

hea*_*kit 1 coding-style background-image sencha-touch

我尝试将图像添加到面板的背景中.图像来自加载的数据.我尝试了以下代码,但没有用:

var topPanel = new Ext.Panel({
        flex:1,
        title:'topPanel',
        style:'style="background-image: url('+this.jsonData.picURL+');'

});
Run Code Online (Sandbox Code Playgroud)

当我创建一个列表时,它与'itemTpl'配合使用.

我也试过了

style:'background-image: url({picURL});'
Run Code Online (Sandbox Code Playgroud)

和...一起

store: {
            fields: ['firstName','lastName', 'picURL'],
            data: this.jsondData
        }
Run Code Online (Sandbox Code Playgroud)

但后来我收到了消息

[[object Object]]不是'Function.prototype.apply'的有效参数.

任何想法都可以帮助!日Thnx

小智 5

您可以通过将对象分配给面板的样式属性来附加自定义样式

style: {
            backgroundImage: 'url(resources/branding/mobile.gif)',
            backgroundRepeat: 'no-repeat',
            backgroundPosition: 'center'
}
Run Code Online (Sandbox Code Playgroud)