Appcelerator侧菜单重定向到另一个屏幕,创建多个屏幕 [英] Appcelerator sidemenu redirect to another screen creating multiple screen
问题描述
我正在我的应用程序中使用此侧面菜单模块。
I am using this sidemenu module in my app.
在侧面菜单中,我有如家,设置等选项。
当我单击设置时,它重定向到设置页面。
现在的问题是打开设置页面时,我使用滑动打开侧边菜单,然后再次单击设置,然后它将再次打开上一个菜单的设置屏幕。
表示创建2个设置屏幕。
如果我再重复一次,它将再次创建设置屏幕。
我该如何预防?
In sidemenu i have option like home, setting etc. When i click on setting, it redirect to setting page. Now problem is when setting page is opened and i open side menu using swipe and again click on setting then it will again open setting screen on previous one. Means it creating 2 setting screen. If i repeat it again then it will creating again setting scree. How do i prevent this?
我的屏幕重定向代码在这里
My code for screen redirection is here
var win = Alloy.createController('Setting').getView();
window.closeOpenView();
$.navWindow.openWindow(win);
推荐答案
存储上次打开的页面:
将其添加到点击功能之外
Add this outside the click function
var openWindow = '';
而这在点击功能内
if (openWindow == 'Setting') return;
openWindow = 'Setting'
var win = Alloy.createController('Setting').getView();
window.closeOpenView();
$.navWindow.openWindow(win);
这假定它在一个函数中,我想这是因为它是一个单击处理程序。如果没有,将其包装在函数中
This assumes this is in a function, which I guess it is because it is a click handler. If not, wrap it in a function
这篇关于Appcelerator侧菜单重定向到另一个屏幕,创建多个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!