2014-01-17 74 views
2

當我添加項目列表流星失去滾動條的時候我加入項目

的頁面重新呈現

但滾動條丟失(這意味着我不能看到頁面的其他部分)

之前,我添加項:後

enter image description here

我加入項目:

enter image description here

添加項(JS):

function resetForm() { 
    form.reset(); 
    $("#goodImgPreview").attr('src', ""); 
    $('#addGoodModal').modal('hide'); 
} 
uploadFile.read(file, function(err, upf) { 
    // 展示 上傳進度條 
    Session.set('createGoodModalContentOnUpload', true); 
    Meteor.call("upload", upf, function(err, fileId) { 
     if (!err) { 
      good.fileId = fileId; 
      goodsCollection.insert(good); 
      resetForm(); 
      Session.set('createGoodModalContentOnUpload', false); 
     } else { 
      Session.set('createGoodModalContentOnUpload', false); 
     } 
    }); 
}); 

顯示錶(HTML):

<div class="row"> 
    {{#each goodList}} 
     {{> goodEdit}} 
    {{/each}} 
</div> 


<template name="goodEdit"> 
    <div class="col-sm-3"> 
     <img src="/uploadDir/{{owner}}/{{fileId}}" alt="" width="160" height="160"> 
     <label for="">{{name}}</label> 
    </div> 
</template> 

顯示錶(JS):

Template.shopEditGoods.goodList = function() { 
    return goodsCollection.find({shopId: Session.get('shopId')}); 
} 

路由器:

Router.map(function() { 
    this.route('shopCreate', {path: '/shopCreate/'}); 

    this.route('shopEditBasic', { 
    path: '/shop/edit/:_id/basic/', 
     layoutTemplate: 'shopEditLayout', 
     waitOn: function() { 
      Session.set('shopId', this.params._id); 
      Session.set('shopEditSideNav', 'shopEditBasic') 
      return Meteor.subscribe('shop', this.params._id); 
     } 
    }); 

    this.route('shopEditGoods', { 
     path: '/shop/edit/:_id/goods/', 
     layoutTemplate: 'shopEditLayout', 
     waitOn: function() { 
      Session.set('shopId', this.params._id); 
      Session.set('shopEditSideNav', 'shopEditGoods') 
      Meteor.subscribe('usergoods'); 
      return Meteor.subscribe('shop', this.params._id); 
     } 
    }); 

    this.route('shopEditPrices', { 
     path: '/shop/edit/:_id/prices/', 
     layoutTemplate: 'shopEditLayout', 
     waitOn: function() { 
      Session.set('shopId', this.params._id); 
      Session.set('shopEditSideNav', 'shopEditPrices') 
      Meteor.subscribe('usergoods'); 
      return Meteor.subscribe('shop', this.params._id); 
     } 
    }); 
}); 

===================================

我找到了解決方法:添加html { overflow: scroll; }到css文件 但我仍然不知道爲什麼發生

+0

屏幕截圖很適合舉例說明,但您需要發佈一些相關的代碼,例如模板和項目源。 – Tobold

+0

@Tobold太好笑了評論:) –

+0

咋,我加了@Tobold我只是不確定問題的準確位置是什麼 – ruandao

回答

2

您還沒有提供任何html。在包含這一切的DIV容器,你可以使用類似:

overflow-y: scoll

在你的CSS來強制滾動條。