如何在Sencha touch中在面板之间移动 [英] How to move between panels in Sencha touch

查看:41
本文介绍了如何在Sencha touch中在面板之间移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在面板之间移动时,出现以下错误

When moving between panels I get the following error

[WARN][Ext.Component#constructor] Registering a component with a id (`logOutButton`) which has already been used. Please ensure the existing component has been destroyed (`Ext.Component#destroy()`. 

我可以返回上一个屏幕,但是如果没有出现以上错误,就无法再次前进.

I can go back to the previous screen but the cannot go forward again without getting the above error.

为了解决这个问题,我尝试使用下面的代码,但是它不起作用.有人可以帮我吗?

To combat this I have tried using the code below, but it does not work. Can anyone help me out?

var loginView = Ext.getCmp('login');
    if(!loginView){
       Ext.getCmp('loginTest2').destroy(); 
      loginView = Ext.create('com.view.Login');
  }

  Ext.Viewport.setActiveItem('login');

我也尝试过:

if(Ext.getCmp('login')){
     Ext.Viewport.setActiveItem('Login');
  }else{

    Ext.Viewport.setActiveItem(Ext.create('com.view.Login'));
  }

这些都不起作用,不会导致相同的错误和黑屏.我正在使用Sencha Touch 2.

Neither of these work and result in the same error and a blank screen. I am using Sencha Touch 2.

推荐答案

我们可以简单地使用以下行从一个面板导航到另一个面板.

we can simply use following line to navigate from one panel to another..

Ext.Viewport.animateActiveItem({ xtype: "cat" }, { type: "slide", direction: "up" });

在这里,xtype是我们可以为要显示的面板定义的内容,就像这样……

here, xtype is that we can define for the panel we want to display, like this...,

Ext.define('BeLocal.view.LeftCurveList', {
       extend: 'Ext.Panel',

       **xtype: 'cat',**

       config: {

       items: [
               {
               xtype: 'toolbar',
               docked: 'top',
               width: '100%',
               padding:0,
               title: 'BeLocal Places',
               items:[{
                      xtype: 'button',
                      ui: 'back',
                      text: 'Back',
                      ]
               },

            ]
       }
       });

这篇关于如何在Sencha touch中在面板之间移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆