【问题标题】:Expected space error issue with gadicc/meteor-reactive-window Meteor Packagegadicc/meteor-reactive-window Meteor 包的预期空间错误问题
【发布时间】:2015-08-28 19:40:25
【问题描述】:

使用gadicc/meteor-reactive-window Meteor Package 根据屏幕大小显示不同的模板。 这是图片DisplatSection.html 文件

            <template name="pictureDisplaySection">
                <div class="display">

                {{#if rwindow.screen('lte','small') }}
                    {{> small}}         
                {{else}}        
                    {{> large}}         
                {{/if}}

                Current jQuery(window).width() is {{rwindow.$width}}
                </div>

            </template>

            <template name="small">
                I am Small
            </template>
            <template name="large">
                I am Large
            </template>

此代码已开始工作,但突然出现此错误

在构建应用程序时: client\template\pictureDisplaySection.html: 4 : 预期空间 ... {{#if rwindow.screen('lte','small') }} ... ^

您的应用程序有错误。等待文件更改。

我试图找到更多信息,但到目前为止还没有运气。非常感谢一些帮助。

谢谢!!!

【问题讨论】:

    标签: javascript jquery html meteor meteor-packages


    【解决方案1】:

    这似乎是一个语法错误。在if块内,函数接收参数用空格隔开而不是括号(..,..,)

    {{#if rwindow.screen 'lte' 'small'}}
      {{> small}}         
    {{else}}        
      {{> large}}         
    {{/if}}
    

    【讨论】:

    • 感谢@Max,一个愚蠢的错误可能会变得如此之大。另一个问题 Max ,当我使用 {{ #if rwindow.screen 'lte' 500}} 时,什么都没有显示。只是背景。 Meteor 没有显示任何错误,我也试过 {{ #if rwindow.screen 'lte' '500'}} 但结果相同,我相信 500 是屏幕的宽度,对吗
    • 是的,我想是的。也许rwindow.screen 不接受数字作为第二个参数,而只接受xsmallsmallmediumlarge
    • 感谢@Max 的回复。继续加油干杯:)
    猜你喜欢
    • 1970-01-01
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-09
    相关资源
    最近更新 更多