Aurelia-Validate가 내 일정 레코드의 필드에서 작동하도록 할 수 없습니다.Aurelia 유효성 검사가 개체 속성과 함께 작동하지 않습니다.
calendar.html (발췌)가 (간체)
<form>
<div class="form-group">
<label class="control-label" for="cal_name_orig">Calendar name</label>
<input type="text" class="form-control" id="cal_name_orig" value.bind="calendar.cal_name_orig & validate">
</div>
<div class="form-group">
<label class="control-label" for="cal_name_tran">Translated name</label>
<input type="text" class="form-control" id="cal_name_tran" value.bind="calendar.cal_name_tran & validate">
</div>
</form>
calendars.js :
import { inject, NewInstance } from 'aurelia-dependency-injection';
import { ValidationController, ValidationRules } from 'aurelia-validation';
import { BootstrapFormRenderer } from '../../common/bootstrap-form-renderer';
@inject(NewInstance.of(ValidationController))
export class CalendarForm {
controller = null;
constructor(controller) {
this.controller = controller;
this.controller.addRenderer(new BootstrapFormRenderer());
this.calendar = {
cal_name_orig = "",
cal_name_tran = ""
}
}
validateCalendar() {
let v = this.controller.validate();
console.log(v);
}
}
ValidationRules
.ensure('calendar.cal_name_orig').required().minLength(5).maxLength(20)
.ensure('calendar.cal_name_tran').minLength(5).maxLength(20)
.on(CalendarForm);
내가 변경하는 경우 value.bind="calendar.cal_name_orig & validate"
value.bind="cal_name_orig & validate"
및 .ensure('calendar.cal_name_orig')
검증 작업, .ensure('cal_name_orig')
및 양식에서 렌더링하지만 데이터는이 클래스의 데이터 오른쪽 부분에 바인딩되지 않습니다.
Aurelia Validate를 통해 calendar.cal_name_orig를 인식하려면 어떻게해야합니까?