【发布时间】:2017-10-18 06:23:46
【问题描述】:
美好的一天。
我有代码:
{
xtype: 'panel',
title: 'test panel',
html:'test,
visible: false// did not work
}
如何防止没有监听器和控制器的显示面板?
【问题讨论】:
美好的一天。
我有代码:
{
xtype: 'panel',
title: 'test panel',
html:'test,
visible: false// did not work
}
如何防止没有监听器和控制器的显示面板?
【问题讨论】:
改用属性hidden:
{
xtype: 'panel',
title: 'test panel',
html:'test',
hidden: true // <<== Should works
}
【讨论】:
hidden 配置通常不适用于零件的视图,只有 Sencha 知道原因。
但是,如果您愿意,可以在部件的 createView 方法中使用一行代码来实现。以你的小提琴为例:
Ext.define('GAINS.parts.ConfigPart', {
extend: 'Ext.dashboard.Part',
alias: 'part.config-part',
config: {
hidden: false,
viewTemplate: {
layout: 'fit',
mergin: 9
}
},
createView: function (config) {
var view = this.callParent(arguments);
view.items = config.configPartItems;
if(config.hidden) view.hidden = true; // apply the "hidden" config to the view.
return view;
}
});
【讨论】: