html控件转换,FlowPortal 从入门到精通

本文介绍如何在YZSoft.Forms.Field.Element控件基础上创建Barcode控件,通过配置xclass属性实现自定义输入效果,包括生成条形码图片。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

任何HTML标签缺省就是YZSoft.Forms.Field.Element控件,支持xdatabind、hiddenexpress等属性,具有控件的基本功能。

为HTML添加xclass属性,可以使该HTML获得xclass所应具有的能力,获得任何想要的输入效果。

控件成为xclass

只需设置xclass属性即可,如:

实现XClass

以barcode控件为例:

25af32ad319860defbbead7f8a7f285f.png

代码如下:

Ext.define('YZSoft.Forms.Field.Barcode', {

extend:'YZSoft.Forms.Field.Element',

getEleTypeConfig:function() {

varme =this,

config = me.callParent(arguments);

Ext.apply(config, {

sDataBind: me.getDataBind(),

Express: me.getExp(),

HiddenExpress: me.getHiddenExp(),

barcodeFormat: me.getAttribute('BarcodeFormat'),

pureBarcode: me.getAttributeBool('PureBarcode')

});

returnconfig;

},

getValue:function() {

returnthis.value ||'';

},

setValue:function(value) {

varme =this,

et = me.getEleType(),

imgEl, url;

me.value = value;

imgEl = me.down('.yz-barcode-image',false);

if(!imgEl)

imgEl = Ext.dom.Helper.append(me.dom,'',true);

if(value) {

url = Ext.String.urlAppend(YZSoft.$url('YZSoft.Services.REST/util/Barcode.ashx'),

Ext.Object.toQueryString({

method:'Encode',

format: et.barcodeFormat,

pureBarcode: et.pureBarcode,

text: value,

width: me.getWidth(),

height: me.getHeight(true)

}));

}

else{

url ='';

}

imgEl.dom.src = url;

}

});

Created with the Personal Edition of HelpNDoc:Full-featured multi-format Help generator

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值