Ext extend 笔录

    技术2025-05-29  12

    Ext.onReady(function() { /*继承方法1*/ var uwin = function(config) { uwin.superclass.constructor.call(this, config); this.showm = config.html; } Ext.extend(uwin, Ext.Window, { showhtml: function() { alert(this.showm); } }); var w = new uwin({ title: "测试", width: 300, height: 300, html: "zjpzjpzjp" }); w.show(); alert(w.height); w.showhtml(); /*继承方法2*/ var uwin = Ext.extend(Ext.Window, { title: "测试", width: 300, height: 300, html: "zjzjpzjp", initComponent: function() { uwin.superclass.initComponent.call(this); }, showhtml: function() { alert(this.html); alert(this.msg); } }) var w = new uwin({ msg: "传值" }); w.show(); alert(w.height); w.showhtml(); /*继承方法3*/ var uwin = function() { //可以定义变量 var msg = "zjp"; this.msgs = msg; uwin.superclass.constructor.call(this, { //重写 title: "测试", width: 300, height: 300, html: "zjpzjpzjp", showhtml: function() { alert(this.msgs); } }) } Ext.extend(uwin, Ext.Window); var w = new uwin(); w.show(); alert(w.height); w.showhtml(); });  

    最新回复(0)