在 sensha touch 中将变量值添加到 class

Adding variable value to class in sensha touch

出于样式目的,我需要 class 将变量值作为 class 名称的一部分

config: {
    cls: 'section cart-item {variable}',
    items: [{
        layout: 'hbox',
        items: [{
            name: 'image',
            cls: 'left',
            flex: 4,
            tpl: [
                '<div style="min-height: 10em"><img src="{thumbnail}" width=100 /></div>
            ].join('')
        }
...

这似乎不起作用。我读过不支持向 cls 添加变量。

接下来要尝试使用 tpl 方法的事情太多了。有没有办法围绕所有内容分解 div 或添加 id 或其他内容?

假设你有一个视图,你想动态分配 class,这里是这样的

Ext.define('someview.namespace',{
    config: {
        cls: 'section cart-item',
        // here all other code
    },
    initialize: function(){
       this.callParent();
       var cls = 'abc'; // here get your class dynamically.
       this.addCls(cls);
    }
});