javascript - Ionic v2 中的布局页面

标签 javascript angular typescript ionic2 ionic3

我想在我的应用程序中拥有一个布局页面(使用 Ionic v2 构建)。由于我希望每个页面上都有导航栏和侧边菜单,因此我认为没有必要将它们添加到项目的所有页面中,对吗?

例如:ASP.NET 有网站的母版页,其中包含每个页面上必须存在的组件。

有谁知道是否有一种简单的方法可以做到这一点?

最佳答案

I think it's unnecessary to add those to all the page's of my project, right?

侧边菜单内容只需在 app.html 文件中添加一次。但关于导航栏,正如您在 this SO post 中看到的那样,@mhartington(来自 Ionic 团队)说:

There is no way to create a global ion-navbar, as this is done on purpose. The point of having a navbar defined for each component is so that we can properly animate the titles, navbar background color (if you change them) and animate other properties needed.

关于创建自定义指令以避免重复 ion-navbar html 代码(我猜这就是您的想法):

That will still creat errors with how angular2 content projection works. We have several issues that have been open when people try this and the best answer is to not do it.

关于javascript - Ionic v2 中的布局页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42574313/

相关文章:

javascript - ionic 2 : "Property ' number' does not exist on type 'typeof"

TypeScript - Puppeteer 库错误 : "Cannot find name ' Element'"

javascript - 在 Visual Studio Code 中自动导入以进行 React-Native 开发

javascript - 如何在每次 ng 服务构建后链接 npm 脚本调用?

php - 表单处理 PHP 和 Javascript

angular - 如何在 Angular 6 中的点击事件中在 matInput 元素上设置自动对焦?

typescript - 在 Angular 2 中以两种方式绑定(bind)组件的属性

typescript - 属性 'runStaticMethod' 是 'DemoClass' 类型的静态成员

javascript - 您使用什么工具来调试 Javascript?

javascript - 比较两个数组值并删除重复值并存储另一个数组 lodash