1
我在Sencha Touch中有一個包含許多不同標籤和按鈕的視圖。我在我的custom.css文件中將它們設計爲我希望它們看起來如何。我想隱藏除一個按鈕之外的所有內容,這樣當點擊該按鈕時,這些元素就會出現。我將這些元素加入了「隱藏的:真實的」。但是,CSS會被忽略,造型太糟糕了。有什麼辦法來保存CSS?我看到了,我可以用「hiddenCls」,但我無法弄清楚如何使用它的任何想法感謝在Sencha Touch中隱藏元素但保留CSS間距
下面是到目前爲止我的代碼:
Ext.define('myApp.view.StartScreen', {
extend: 'Ext.Container',
xtype: 'startscreen',
config: {
layout: {
type: 'vbox',
align: 'middle'
},
items: [{
xtype: 'toolbar',
docked: 'top',
title: 'My App',
items: [{
xtype: 'button',
iconMask: true,
iconCls: 'refresh',
width: 42
}, { xtype: 'spacer' }, {
xtype: 'button',
iconMask: true,
iconCls: 'user'
}]
}, {
xtype: 'label',
html: 'Discussions',
cls: 'item-title-label',
name: 'itemTitleLabel',
hidden: true,
hiddenCls: 'x-item-title-label-hidden'
}, {
xtype: 'label',
html: 'Hi',
cls: 'case-number-label',
name: 'caseNumberLabel',
hidden: true,
hiddenCls: 'x-case-number-label-hidden'
}, {
xtype: 'label',
html: '0:00',
cls: 'duration-label',
name: 'durationLabel',
hidden: true,
hiddenCls: 'x-duration-label-hidden'
}, {
xtype: 'label',
html: 'Started at 13:42',
cls: 'time-started-label',
name: 'timeStartedLabel',
hidden: true,
hiddenCls: 'x-time-started-label-hidden'
}, {
xtype: 'button',
text: 'Start',
ui: 'confirm',
cls: 'big-start-button',
name: 'bigStartButton'
}, {
xtype: 'button',
text: 'Off',
ui: 'decline',
cls: 'big-off-button',
name: 'bigOffButton',
hidden: true,
hiddenCls: 'x-off-button-hidden'
}]
}
});
謝謝,這工作的。但是,我怎麼能設置的知名度,真正的用我的煎茶觸摸代碼在JavaScript? – bnrq 2013-05-12 00:08:00
@bnrq我不知道但你可以使用一個類(例如'.hidden {visibility:hidden}' )並將該類添加到要隱藏的組件。 – Musa 2013-05-12 00:18:45
我其實已經想通了!我可以使用getElementById,然後將可見性設置爲「可見」(如:itemTitle.style.visibility ='visible')。謝謝你的幫助! – bnrq 2013-05-12 00:25:08