sencha touch How to make navigation like Touch-The

2019-08-20 05:41发布

I am creating an app in which I have to create the popup like sencha touch theming expample to select the navigation items.

enter image description here

I tried to see its code on github for a hint but don't know what I am missing hare is my code for header bar and the list button.

Ext.define('ov_app.view.HeaderBar', {
xtype : 'HeaderBar',
extend:'Ext.Toolbar',

config: {
           // xtype : 'toolbar',
    ui: 'plain',        
    docked: 'top',
    cls: 'menuBar',
    border:0,
    defaults:{
        border: 0,
        },
    items: [

        {
            iconCls: 'list',
            iconMask: true,
            ui: 'plain',
            action: 'ShowMoreOption',
        },{
            xtype: 'spacer'
        },{
            xtype: 'container',
            html: '<img src="resources/images/logo.png">'
        },{
            xtype: 'spacer'
        },{
            iconCls: 'home',
            iconMask: true,
            id: 'homeBtn',
            ui: 'plain',
            action: 'push-view'
        }
    ]
}
});

`

and code for my controller main.js to Handel the tab action on list button.

Ext.define('ov_app.controller.MainController', {
extend: 'Ext.app.Controller',
config:{
    control: {
        'button[action=push-view]': {
            tap: 'pushViewFunction'
       },
         'button[action=ShowMoreOption]':{
    tap: 'togglMenu'
    },
    },
},

pushViewFunction: function() {
ov_app.container.setActiveItem(0);
},
togglMenu: function(){
console.log("hello");
}
togglMenu: function(button) {
    this.getStyleBubble().showBy(button)
},
});

`

when I try to click on the list button on the top the error i see in my console is this

Uncaught TypeError: Object [object Object] has no method 'getStyleBubble'

and also I didn't see any definition for this 'getStyleBubble' function in any of the file in model, views, controller, store directories. So is it defined in any touch directories files or I am missing something.

1条回答
Evening l夕情丶
2楼-- · 2019-08-20 06:21

There is no getStyleBubble() function deceleration in the controllers file also not in any file if you download the whole source code zip folder I think they have not uploaded complete source code. But i found solution to my answer. I have to create a new panel and make it toggle with the click of the list button like this.

 togglMenu: function(button){
    if(!this.overlay) {
    this.overlay = Ext.Viewport.add({
        xtype: 'panel',
        modal: true,
        hideOnMaskTap: true,
        showAnimation: {
            type: 'popIn',
            duration: 250,
            easing: 'ease-out'
        },
        hideAnimation: {
            type: 'popOut',
            duration: 250,
            easing: 'ease-out'
        },
        height: 200,
        width: 200,
        //centered: true,
        styleHtmlContent: true,
        html: '<p>hello dummy content in the pop up box </p>',
        scrollable: true
    });
}
this.overlay.showBy(button);

`

enter image description here

查看更多
登录 后发表回答