gpt4 book ai didi

javascript - Famo.us ScrollContainer 不滚动

转载 作者:行者123 更新时间:2023-11-30 00:29:22 25 4
gpt4 key购买 nike

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);
};

关于javascript - Famo.us ScrollContainer 不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30188681/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com