我有App.js
(function() {
Window = require('ui/tablet/ApplicationWindow');
}
new Window().open();
})();
从那里ApplicationWindow.js
加载。
在ApplicationWindow.js
function ApplicationWindow() {
//load component dependencies
var FirstView = require('ui/common/FirstView');
//create component instance
var self = Ti.UI.createWindow({
backgroundColor:'#ffffff'
});
var win2 = Titanium.UI.createWindow({
backgroundColor: 'red',
title: 'Red Window'
});
//construct UI
var firstView = new FirstView();
var nav = Titanium.UI.iPhone.createNavigationGroup({
window: win2
});
win2.add(firstView);
self.add(nav);
self.open();
//self.add(firstView);
if (Ti.Platform.osname === 'ipad') {
self.orientationModes = [Ti.UI.LANDSCAPE_LEFT] ;
};
return self;
}
//make constructor function the public component interface
module.exports = ApplicationWindow;
我得到一个带有 2 个文本字段和一个按钮登录的FirstView.js
视图。该视图有一个标题为红色窗口的导航栏。我想在 loginButton Click 上加载 Home.js。这是 loginButtonClick 代码:
loginButton.addEventListener ('click', function(e){
//navigate to Home.js
});
我该怎么做。谁能帮帮我。