提交 5161db9b 编写于 作者: KK's avatar KK

失去焦点事件校验

上级 651560c7
......@@ -1277,17 +1277,17 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public checkRule(name:string){
public checkRule(name:string,event:string){
let erro_text :any = "";
let checkValue = this.data[name];
this.rules[name].forEach((item:any)=>{
if(item.hasOwnProperty('pattern') && item.trigger == 'change' && checkValue){
if(item.hasOwnProperty('pattern') && item.trigger == event && checkValue){
let pattern: any = item.pattern;
if(!pattern.test(checkValue)){
erro_text = item.message;
}
}
if(item.hasOwnProperty('required') && item.trigger == 'change'){
if(item.hasOwnProperty('required') && item.trigger == event){
if(item.required && !checkValue){
erro_text = item.message;
}
......
<app-mob-input class="app-form-item-input" @change="($event)=>{this.data.${editor.name} = $event;this.checkRule('${editor.name}')}" :type="'text'" :value="data.${editor.name}" :disabled="detailsModel.${editor.name}.disabled" <#if editor.getPlaceHolder()??> placeholder="${editor.getPlaceHolder()}"</#if>></app-mob-input>
\ No newline at end of file
<app-mob-input class="app-form-item-input" @blur="()=>{this.checkRule('${editor.name}','blur')}" @change="($event)=>{this.data.${editor.name} = $event;this.checkRule('${editor.name}','change')}" :type="'text'" :value="data.${editor.name}" :disabled="detailsModel.${editor.name}.disabled" <#if editor.getPlaceHolder()??> placeholder="${editor.getPlaceHolder()}"</#if>></app-mob-input>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册