css - Add logo in extjs tab panel
问题描述
I have created a tab panel using Extjs
Ext.define('tabPanel.view.MyTabPanel', {
extend: 'Ext.tab.Panel',
alias: 'widget.mytabpanel',
requires: [
'tabPanel.view.MyTabPanelViewModel',
'Ext.Toolbar',
'Ext.Img'
],
viewModel: {
type: 'mytabpanel'
},
activeItem: 1,
items: [
{
xtype: 'toolbar',
docked: 'top',
title: '',
layout: {
type: 'hbox',
align: 'start',
pack: 'center'
},
items: [
{
xtype: 'image',
height: 78,
width: 101,
src: 'https://www.gravatar.com/avatar/46c7c14743be3064db03681e16e55fd3?s=48&d=identicon&r=PG&f=1'
}
]
},
{
xtype: 'container',
title: 'Tab 1'
},
{
xtype: 'container',
title: 'Tab 2'
},
{
xtype: 'container',
title: 'Tab 3'
}
]
});
I was trying to make the panel header as my site header. I was tried to add a logo before the tab buttons. But the alignment was not working as expected. Is it possible to set the logo in the left and the tab buttons after the logo. Is it possible?
解决方案
不知道这是否正确,或者这是否是您期望的结果,但我的解决方案是使用tabBar
选项卡面板中的配置来添加徽标,并在创建组件后添加我想要的其他选项卡.
tabBar: {
items: [{
xtype: 'image',
height: 78,
width: 101,
src: 'https://www.gravatar.com/avatar/46c7c14743be3064db03681e16e55fd3?s=48&d=identicon&r=PG&f=1'
}]
},
listeners: {
beforerender: function (cmp) {
cmp.insert(1, [{
xtype: 'container',
title: 'Tab 1',
}, {
xtype: 'container',
title: 'Tab 2'
}, {
xtype: 'container',
title: 'Tab 3'
}])
}
}
我必须在创建组件后添加其他面板,因为默认情况下,tabbar 项是在 tabpanel 项之后添加的,在创建组件后添加它们,徽标将在其他面板的左侧
检查小提琴
推荐阅读
- javascript - 使用 API 将数据添加到我用于传单地图的 globe.gl
- reactjs - 合并反应打字稿命名空间声明
- python - Python Clear() 方法来删除一个字典
- python - Tensorflow 1.15-IOError:[Errno 32] 断管
- angular - 如何在 Fullcalendar 5 中动态更改 snapDuration
- c# - 我应该使用哪种类型的库在 C# 中进行 Socket 编程?
- python - 在 Django 中,仅生成 s3 客户端 generate_presigned_post,内容类型为 mp4 文件上传
- gatling - 在 Gatling 中,我们可以在自定义错误消息中插入变量吗
- numbers - WinAppDriver / AZERTY 键盘:sendkeys() 未正确发送数字
- python - Python GUI 弹出窗口