Famo.us ScrollContainer 不滚动
Famo.us ScrollContainer not scrolling
define(function(require, exports, module){
var View = require('src/core/View');
var Surface = require('src/core/Surface');
var ScrollContainer = require('src/views/ScrollContainer');
function ListView(){
View.apply(this, arguments);
_createContent.call(this);
}
ListView.prototype = Object.create(View.prototype);
ListView.prototype.constructor = ListView;
ListView.DEFAULT_OPTIONS = {
data: []
}
function _createContent(){
var sc = new ScrollContainer();
var sequence = [];
sc.sequenceFrom(sequence);
for (var i = 0; i < this.options.data.length; i++) {
var surface = new Surface({
content: this.options.data[i].name,
size: [undefined, 40],
properties: {
borderBottom: '1px solid #000',
padding: '10px 15px'
}
});
sequence.push(surface);
};
this.add(sc);
}
module.exports = ListView;
});
如您所见,我的问题是Famo.us ScrollContainer 没有滚动。上面的代码用于添加一个可滚动的列表。然后,此模块包含在 PageView 中。 PageView 包含在 MainView 中,它有一个 RenderController 来显示或隐藏页面。该列表与传递给该模块的数据一起显示。唯一的问题是滚动。有什么想法吗?
surface
需要将事件传送到 ScrollContainer
。
for (var i = 0; i < this.options.data.length; i++) {
var surface = new Surface({
content: this.options.data[i].name,
size: [undefined, 40],
properties: {
borderBottom: '1px solid #000',
padding: '10px 15px'
}
});
surface.pipe(sc); // Pipe the Surface events to the ScrollContainer
sequence.push(surface);
};
define(function(require, exports, module){
var View = require('src/core/View');
var Surface = require('src/core/Surface');
var ScrollContainer = require('src/views/ScrollContainer');
function ListView(){
View.apply(this, arguments);
_createContent.call(this);
}
ListView.prototype = Object.create(View.prototype);
ListView.prototype.constructor = ListView;
ListView.DEFAULT_OPTIONS = {
data: []
}
function _createContent(){
var sc = new ScrollContainer();
var sequence = [];
sc.sequenceFrom(sequence);
for (var i = 0; i < this.options.data.length; i++) {
var surface = new Surface({
content: this.options.data[i].name,
size: [undefined, 40],
properties: {
borderBottom: '1px solid #000',
padding: '10px 15px'
}
});
sequence.push(surface);
};
this.add(sc);
}
module.exports = ListView;
});
如您所见,我的问题是Famo.us ScrollContainer 没有滚动。上面的代码用于添加一个可滚动的列表。然后,此模块包含在 PageView 中。 PageView 包含在 MainView 中,它有一个 RenderController 来显示或隐藏页面。该列表与传递给该模块的数据一起显示。唯一的问题是滚动。有什么想法吗?
surface
需要将事件传送到 ScrollContainer
。
for (var i = 0; i < this.options.data.length; i++) {
var surface = new Surface({
content: this.options.data[i].name,
size: [undefined, 40],
properties: {
borderBottom: '1px solid #000',
padding: '10px 15px'
}
});
surface.pipe(sc); // Pipe the Surface events to the ScrollContainer
sequence.push(surface);
};