【问题标题】:Why does my meteoric only randomly show the ionic html boilerplate?为什么我的流星只随机显示 ionic html 样板?
【发布时间】:2015-07-15 05:05:17
【问题描述】:

我正在使用 ionic 为智能手机开发一个流星应用程序。

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

在我看来它是随机的,但也许不是。

如何让我的所有模板都显示 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 ionic 按预期工作,但 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 路线

我也试过了:

  • 在没有线索的情况下使用 meteor debug 调试应用程序 如何正确处理我的问题
  • 使用 meteor reset 重置我的应用程序
  • 将我的应用程序作为 android 应用程序运行

为什么我的布局没有正确显示在每个视图中?

【问题讨论】:

  • 您有一个名为 about 的模板和另一个名为 about2 的模板,它们的代码完全相同,但显示的内容不同?
  • 没错。 about2 在文件夹 client/templates/about2 中的 about2.html 中 about 在 client/templates/about 中的 about.html 没有修改模板的 javascript 代码,我已经编写了。我什至用不同的浏览器尝试过,以确保它没有缓存问题。
  • altergear.net/media/tmp/p131_uploaded.zip 这个 77kb 的重置流星项目重现了错误。

标签: javascript node.js meteor ionic meteoric


【解决方案1】:

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

未设置默认布局。

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

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

我第一次关注this 教程,但它是从 2013 年开始的,所以似乎太旧了。此外,正如 #meteor 中的 zerovapor 告诉我的那样,尚不清楚 Router.map 是否仍受支持。所以我将使用this later tutorial中指定的Iron-Router。

【讨论】:

    猜你喜欢
    • 2017-09-23
    • 1970-01-01
    • 2017-01-16
    • 1970-01-01
    • 1970-01-01
    • 2019-07-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多