当前位置: 代码迷 >> 综合 >> ExtJS6.2开发-首页左菜单区域(三)
  详细解决方案

ExtJS6.2开发-首页左菜单区域(三)

热度:38   发布时间:2023-12-25 23:35:36.0

菜单区域开发
一、创建做左菜单组件
1.在在app目录下创建main\core\index\component下创建indexLeftMenu.js
2.编写基础代码如下:

Ext.define('appCenter.main.core.index.component.indexLeftMenu', {
    extend : 'Ext.panel.Panel',alias : 'widget.indexLeftMenu',reference:'indexLeftMenu',requires : [ 'appcenter.main.core.index.component.indexMenuTree'],layout : {
    type : 'fit'},iconCls : 'fa fa-list',title : '功能模块',tools : [{
    type : 'expand',reference : 'expandtool',handler : 'expandTreeMenu',hidden:false,tooltip : '展开所有菜单项'}, {
    type : 'collapse',reference : 'collapsetool',handler : 'collapseTreeMenu',hidden:false,tooltip : '折叠所有菜单项'}],initComponent : function() {
    this.items = [{
    xtype : 'indexMenuTree'}];this.callParent();}});

3.在在app目录下创建main\core\index\component下创建indexMenuTree.js.js
4.编写基础代码如下

Ext.define('appcenter.main.core.index.component.indexMenuTree', {
    extend : 'Ext.tree.Panel',alias : 'widget.indexMenuTree',reference:'indexMenuTree',rootVisible : false,lines : false,initComponent : function() {
    this.style = "";this.callParent(arguments);}
});

5.在index主视图引入,代码如下:

Ext.define('appcenter.main.core.index.view.index', {
    extend: 'Ext.container.Viewport',xtype: 'app-main',id : 'appviewport',requires : [ 'appcenter.main.core.index.component.indexTop','appcenter.main.core.index.component.indexLeftMenu',],layout : {
    type : 'border' },items : [ {
    xtype : 'indexTop',region : 'north'}, {
    region : 'west', xtype : 'indexLeftMenu',width : 230,collapsible : true,split : true,hidden : false }, {
    region : 'center', html : 'center'}]
});

6.运行结果如下图:
在这里插入图片描述
7.数据在后面统一灌入。