【发布时间】:2018-11-11 03:25:39
【问题描述】:
我正在使用 Extjs 6.5.3。
我想创建自定义布局或配置,这样当我在文件中使用它时,所有面板都可以折叠。
我知道 ExtJS 有 Accordion 布局,使用它我们可以使所有面板可折叠,但即使我们添加 multi: true 配置,同时打开多个面板时,Accordion 布局也会出现问题。它不允许同时展开和关闭多个面板。
下面是不允许同时打开多个面板的例子,即使添加了multi:true
Ext.create('Ext.panel.Panel', {
title: 'Accordion Layout',
width: 300,
height: 300,
defaults: {
// applied to each contained panel
bodyStyle: 'padding:15px'
},
layout: {
// layout-specific configs go here
type: 'accordion',
titleCollapse: false,
animate: true,
multi: true,
activeOnTop: true
},
items: [{
title: 'Panel 1',
html: 'Panel content!'
}, {
title: 'Panel 2',
html: 'Panel content!'
}, {
title: 'Panel 3',
html: 'Panel content!'
}],
renderTo: Ext.getBody()
});
我也知道通过使用 vbox 布局,我们可以让面板像下面那样折叠
Ext.create('Ext.panel.Panel', {
title: 'Accordion Layout',
width: 300,
height: 300,
defaults: {
// applied to each contained panel
bodyStyle: 'padding:15px',
collapsible: true
},
layout: {
// layout-specific configs go here
type: 'vbox'
},
items: [{
title: 'Panel 1',
html: 'Panel content!'
}, {
title: 'Panel 2',
html: 'Panel content!'
}, {
title: 'Panel 3',
html: 'Panel content!'
}],
renderTo: Ext.getBody()
});
但我想将它作为配置或自定义布局,以便我可以在任何地方重复使用它。为此,我没有找到任何方法。
【问题讨论】: