我试图将选项卡和侧面菜单结合在一起,但我对自己做错的事情感到困惑。因为root属于sidemenu ..
import {App, IonicApp, Platform} from 'ionic-framework/ionic';
import {HelloIonicPage} from './pages/hello-ionic/hello-ionic';
import {ListPage} from './pages/list/list';
import {TabsPage} from './pages/tabs/tabs';
// https://angular.io/docs/ts/latest/api/core/Type-interface.html
import {Type} from 'angular2/core';
@App({
templateUrl: 'build/app.html',
config: {} // http://ionicframework.com/docs/v2/api/config/Config/
})
class MyApp {
// make HelloIonicPage the root (or first) page
rootPage: Type = HelloIonicPage;
pages: Array<{title: string, component: Type}>;
constructor(private app: IonicApp, private platform: Platform) {
this.initializeApp();
// set our app's pages
this.pages = [
{ title: 'Hello Ionic', component: HelloIonicPage },
{ title: 'My First List', component: ListPage },
{ title: 'testing tabs', component: TabsPage}
];
}
initializeApp() {
this.platform.ready().then(() => {
// The platform is now ready. Note: if this callback fails to fire, follow
// the Troubleshooting guide for a number of possible solutions:
//
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
//
// First, let's hide the keyboard accessory bar (only works natively) since
// that's a better default:
//
// Keyboard.setAccessoryBarVisible(false);
//
// For example, we might change the StatusBar color. This one below is
// good for dark backgrounds and light text:
// StatusBar.setStyle(StatusBar.LIGHT_CONTENT)
});
}
openPage(page) {
// close the menu when clicking a link from the menu
this.app.getComponent('leftMenu').close();
// navigate to the new page if it is not the current page
let nav = this.app.getComponent('nav');
nav.setRoot(page.component);
}
}
我是ionic的新手,并且遵循以下教程http://ionicframework.com/docs/v2/getting-started/tutorial/
它具有选项卡或侧面菜单,但没有两者。我已经导入了标签,但是我不确定下一步要做什么,因为rootPage
属于HelloIonicPage
,我不想更改。
尚不清楚为什么您需要执行此操作,但是有可能并且附加的链接中包含将模板生成的两个程序合并在一起的代码。生成的程序使用tab1页面作为“入门”页面。每个选项卡页面都提供侧边栏菜单。
我将“ tabs”程序的pages文件夹中的文件夹复制到了“ sidemenu”程序。
从“入门”中,我复制了导航条形码和侧栏菜单。这似乎由选项卡2和选项卡3页面继承,包括指定的标题(不确定原因)。因此,我在每个页面中添加了一个带有tab2和tab3标题的h1,作为标记。
我修改了app.ts文件,以导入在步骤1中添加的页面。
我添加了import语句来导入app.core.scss中的page1,page2和page3 html文件
该方法可以允许在侧栏上添加登录屏幕和其他实用程序屏幕(例如搜索)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句