0

我正在为具有离子的智能手机开发流星应用程序。

不幸的是,显示背景颜色和后退按钮的 ionic 样板代码显示在我的一些网站上,而在一些网站上则没有。

这对我来说似乎是随机的,但也许不是。

如何让我的所有模板都显示离子主题?

项目细节的描述以及我到目前为止所尝试的内容现在将遵循......

这是我的包裹清单:

aldeed:collection2       2.3.1* Automatic validation of insert and update operations on the client and server.
anti:i18n                0.4.3  Internalization: simplest package
fourseven:scss           2.0.1_5* Style with attitude. Sass and SCSS support for Meteor.js (with autoprefixer and sourcem...
iron:router              1.0.9  Routing specifically designed for Meteor
mdg:reload-on-resume     1.0.4  On Cordova, only allow the app to reload when the app is resumed.
meteor-platform          1.2.2  Include a standard set of Meteor packages in your app
meteoric:autoform-ionic  0.1.5  Ionic theme for Autoform
meteoric:ionic           0.1.17  Ionic components for Meteor. No Angular!
meteoric:ionic-sass      0.1.9  Ionic's CSS Framework in SASS and bundled for Meteor.
meteoric:ionicons-sass   0.1.6  Ionic's Ionicons library in SASS and bundled for Meteor.
spacebars                1.0.6  Handlebars-like template language for Meteor

这是我所做的测试的描述和有关该问题的屏幕截图: 对于名为:“about”的模板,显示了离子主题。我确实将模板代码复制到了一个名为 about2.html 的文件中,并将模板命名为 about2。我添加了一条名为 about2 的路线。结果是 about.html 离子按预期工作,但 about2.html 没有。

我检查了包含的 css 文件,两个页面都相同。

由 javascript 生成的 html 代码是不同的。

这是我关于模板的代码:

    <template name="about">

    {{#contentFor "headerButtonLeft"}}
        <div class="buttons">
            {{>myIonBackButton path="main" }}
        </div>
    {{/contentFor}}


    {{#contentFor "headerTitle"}}
        <h1 class="title">{{i18n 'about.title'}}</h1>
    {{/contentFor}}

    {{#ionView}}
        {{#ionContent}}
            <p>
                {{i18n 'about.content'}}

                Hello world

                {{i18n 'backButton'}}
            </p>
        {{/ionContent}}
    {{/ionView}}
</template>

以下是我设置路线的方式:

Router.map(function(){

  /*Main menu*/

  this.route('about');
  this.route('about2');


});

以下是显示我确实遇到的问题的屏幕截图: 关于路线 在此处输入图像描述

about2 路线 在此处输入图像描述

我也试过:

  • 在不知道如何正确处理我的问题的情况下使用流星调试来调试应用程序
  • 流星重置重置我的应用程序
  • 将我的应用程序作为 android 应用程序运行

为什么我的布局不能正确显示每个视图?

4

1 回答 1

0

我通过重写 routes.js 文件解决了这个问题。

未设置默认布局。

Router.configure({
  layoutTemplate: 'appLayout'
});

让我感到困惑的是,如果没有设置,为什么 ionic 有时会显示布局。

我首先遵循了这个教程,但它是从 2013 年开始的,所以似乎太旧了。此外,正如 #meteor 中的 zerovapor 告诉我的那样,尚不清楚 Router.map 是否仍受支持。因此,我将使用稍后教程中指定的 Iron-Router 。

于 2015-07-14T21:05:17.573 回答