1

这是我坚持的事情:

Ext.define('Application.view.phone.AppScreen', {
extend: 'Ext.navigation.View',
//  extend: 'Ext.Container',
xtype: 'appscreen',
id: 'appscreen',
alias: 'widget.appscreen',
config: {

    items: [{
        xtype: 'container',
        title: 'My View',
        layout: {
            type: 'fit'
        },
        items:[{
            html:'phone'
        },

        {
            xtype:'list',
            id:'AccountSummary',
            name:'AccountSummary',
            onItemDisclosure:true,
            store:{
                fields: ['Label', 'Amount'],
                data: [
                {
                    "Label":"Order",
                    "Amount": "18,275"
                },

                {
                    "Label":"Shipment",
                    "Amount": "25,255"
                },

                {
                    "Label":"Invoices",
                    "Amount": "11,125"
                }
                ]
            }, 

        itemTpl: new Ext.XTemplate('{Label}<tpl if="Label==Order"><div class="meter"><span style="width: 60%"></span></div></tpl><tpl if="Label==Shipment"><div class="meter1"><span style="width: 60%"></span></div></tpl><br>$ {Amount} Cash')

        }]
    }]
}

});

我需要动态更改 css,例如如果标签是 order 我需要应用 css 仪表,类似于 Shipment 的仪表 1。有人可以帮我吗?

4

1 回答 1

1

这应该相当简单,看看下面我的工作 TPL 示例:

new Ext.Container({
    fullscreen : true,
    tpl        : '<tpl if="foo == &quot;bar&quot;">Is Bar</tpl>',
    data       : {
        foo : 'bar'
    }
});

我认为您只需要在您的语句中添加编码引号,因为您检查了一个字符串,请参阅下面的更新代码:

itemTpl: new Ext.XTemplate('{Label}<tpl if="Label == &quot;Order&quot;"><div class="meter"><span style="width: 60%"></span></div></tpl><tpl if="Label == &quot;Shipment&quot;"><div class="meter1"><span style="width: 60%"></span></div></tpl><br>$ {Amount} Cash')
于 2012-08-08T17:21:47.647 回答