@zenweb/form
Version:
Zenweb Form module
41 lines (40 loc) • 762 B
JavaScript
export class Widget {
option = {
type: this.constructor.name,
};
/**
* 显示名
*/
label(label) {
this.option.label = label;
return this;
}
/**
* 帮助信息
*/
help(help) {
this.option.help = help;
return this;
}
/**
* 提示信息
*/
placeholder(text) {
this.option.placeholder = text;
return this;
}
/**
* 只读,即使提交也不会更新
*/
readonly(is = true) {
this.option.readonly = is;
return this;
}
/**
* 输出结果给客户端
* - 内部调用
*/
output() {
return Object.assign({}, this.option, this.extra ? this.extra() : undefined);
}
}