2015-08-28 22 views
0

使用gadicc/meteor-reactive-window Meteor Package根據屏幕大小顯示不同的模板。 這是pictureDisplatSection.html文件使用gadicc/meteor-reactive-window預計的空間錯誤問題流星包

  <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> 

此代碼已開始intially工作,但出藍色的,它已經開始給這個錯誤

在構建應用程序: 客戶端\模板\ pictureDisplaySection.html:4 :預期空間 ... {{#如果rwindow.screen( 'LTE', '小')}} ... ^

您的應用程序有錯誤。等待文件更改。

我試圖找到更多的信息,但沒有運氣,直到現在。真的很感謝一些幫助。

謝謝!

回答

0

這似乎是一個語法錯誤。裏面的if塊,函數接收與分離,而不是括號的空間參數(..,..,)

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

謝謝@Max,只是一個愚蠢的錯誤可能會很大。還有一個問題Max,當我使用{{#if rwindow.screen'lte'500}}時,沒有任何東西會顯示。只是背景。流星沒有顯示任何錯誤,我也嘗試過{{#if rwindow.screen'lte''500'}}但結果相同,我相信500是屏幕的寬度,我是對的 – SandeepC

+0

是的,我認爲是。也許'rwindow.screen'不接受作爲第二個參數的數字,而只接受'xsmall','small','medium'和'large'。 – Max

+0

感謝@Max作出迴應。保持你的善良工作乾杯:) – SandeepC