zl程序教程

您现在的位置是:首页 >  其他

当前栏目

SAP UI5控件aggregation的一个模拟实现

SAP模拟 实现 一个 控件 UI5 Aggregation
2023-09-14 09:02:40 时间
<html>
<script>

function Aggregation(name) {
	this.mAggregationName = name;
}

var oItemAgg = new Aggregation("item"); // so far, Aggregation oject has no available method

debugger;

Aggregation.prototype.generate = function(add, prototype) {
	// var that = this, n = that.mAggregationName;
	
	add("getAggregation", prototype, function() { 
		console.log(" getAggregation should be implemented here!"); 
	});
}

function add(name, proto, fn){
	if ( !proto[name] ) {
		proto[name] =  fn;
	}
}

oItemAgg.generate(add, Aggregation.prototype);

oItemAgg.getAggregation();
			
debugger;

var Sub = function(name) {  
	Aggregation.call(this, name);
	// sub own logic here 
};  

Sub.prototype = new Aggregation();  

var subAggregation = new Sub("Sub");

debugger;
</script>