2
當我添加項目列表流星失去滾動條的時候我加入項目
的頁面重新呈現
但滾動條丟失(這意味着我不能看到頁面的其他部分)
之前,我添加項:後
我加入項目:
添加項(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文件 但我仍然不知道爲什麼發生
屏幕截圖很適合舉例說明,但您需要發佈一些相關的代碼,例如模板和項目源。 – Tobold
@Tobold太好笑了評論:) –
咋,我加了@Tobold我只是不確定問題的準確位置是什麼 – ruandao