标签:
回调函数updateImage中的key参数,在外部调用时有程序员自己指定.
使用Ext.Function.bind(this.updateImage, this, ‘imageUrl‘, true)
参数一:updateImage函数引用,
参数二:this(固定写法)
参数三:程序员自定义updateImage函数引用中的key参数值
参数四:true (固定写法)
showSelectImageWindow: function() { var me = this.getView(); this.selectImage(Ext.Function.bind(this.updateImage, this, ‘imageUrl‘, true)); }, showSelectLogoWindow: function() { var me = this.getView(); this.selectImage(Ext.Function.bind(this.updateImage, this, ‘logoUrl‘, true)); }, showSelectPhotoWindow: function() { var me = this.getView(); this.selectImage(Ext.Function.bind(this.updateImage, this, ‘bzLicensePhotoUrl‘, true)); }, selectImage: function(callback) { if (!this.imgWindow) { this.imgWindow = Ext.create(‘app.ux.window.SelectImageWindow‘, { callback: callback }); } else { Ext.apply(this.imgWindow, {callback: callback}); } this.imgWindow.show(); }, updateImage: function(url, title, uploadId, key) { this.getView().getViewModel().set(key, url); },
Extjs使用Ext.function.bind, 给句柄函数传参
标签:
原文地址:http://www.cnblogs.com/cocoat/p/5166984.html