我在一个模块中有一个滚动视图,该视图加载从其他模块返回的视图。
包含scrollview的模块:
define(function(require, exports, module) {
var View = require('famous/core/View');
var Utility = require('famous/utilities/Utility');
var Scrollview = require('famous/views/Scrollview');
var HomeView = require('views/HomeView');
var DescriptionView = require('views/DescriptionView');
var paginationView = new Scrollview({
direction: Utility.Direction.X
});
var AppViews = [
HomeView,
DescriptionView
];
paginationView.sequenceFrom(AppViews);
module.exports = paginationView;
});
这是模块代码
define(function(require, exports, module) {
var View = require('famous/core/View');
var Surface = require('famous/core/Surface');
var FlexScrollView = require('famous-flex/FlexScrollView');
var MainView = require('views/MainView');
var EventHandler = require('famous/core/EventHandler');
function HomeView() {
View.apply(this, arguments);
}
HomeView.prototype = Object.create(View.prototype);
HomeView.prototype.constructor = HomeView;
HomeView.DEFAULT_OPTIONS = {};
var homeView = new HomeView();
var scrollView = new FlexScrollView();
homeView.add(scrollView);
for (var i = 0, temp; i < 40; i++) {
var surface = new Surface({
content: "Surface: " + (i + 1),
size: [undefined, 200],
properties: {
backgroundColor: "hsl(" + (i * 360 / 40) + ", 100%, 50%)",
lineHeight: "200px",
textAlign: "center"
}
});
surface.pipe(scrollView);
// ... I want to pipe to the parent scrollview here ...
如何将表面从第二个模块传递到第一个模块的滚动视图?我仍在学习整个事件管道,不确定如何在这里实现它。我知道,由于我继承自著名的View模块,因此我应该能够访问一些高级事件管理,但是对于我的情况该如何处理却一无所知。
该模块HomeView
扩展了Famo.us View
,因此您可以将表面通过管道传递给事件处理程序HomeView
// ... I want to pipe to the parent scrollview here ...
Surface.pipe(this._eventOutput);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句