0.0.1 • Published 11 months ago
qqsl-store-form-plugin v0.0.1
QqslStoreFormPlugin
该表单插件基于 @tethys/store,为能够将angular中的form与store中的相应字段快速绑定而开发。
指令 thyStoreForm
<form [formGroup]="form" [thyStoreForm]="store" thyStatePath="obj.form" thyDebounce="-1" [thyClearDestroy]="true">
<input type="text" formControlName="value">
</form>
- thyStatePath为store中的表单内容对应的路径
- thyDebounce表示防抖时间,为-1则不防抖,每次数据同步更新
- thyClearDestroy表示,该组件销毁后是否重置store中的对应表单内容
- thyDynamic, 是否是动态表单,开启后,指令会在初始化时将表单内容同步至store
createFormModel
在store中使用createFormModel构建表单内容,该函数返回如下:
interface FormModelState<T> {
// 当表单被重置的时候,model为null,目前尚不支持nuNullAble。
model: T | null;
dirty: boolean | null;
// 字段类型和angular保持一致
status: FormControlStatus | null;
errors: ValidationErrors | null;
}
0.0.1
11 months ago