fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
697 B

import { isObject, each, isNull, isNotNull } from "../../2.base";
export const registAttrFun = Element => {
Element.registerFunction("attr", function (key, value) {
if (isObject(key)) {
each(key, (k, v) => {
this.attr(k, v);
});
return this;
}
if (isNull(value)) {
return this.attribs[key];
}
this.attribs[key] = value;
return this;
});
Element.registerFunction("hasAttrib", function (key) {
return isNotNull(this.attribs[key]);
});
Element.registerFunction("removeAttr", function (key) {
delete this.attribs[key];
});
};