Appcelerator sidemenu 重定向到另一个屏幕创建多个屏幕 [英] 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 sidemenu 重定向到另一个屏幕创建多个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!