import {Component, OnInit, ViewChild} from '@angular/core'; @Component({ selector: 'app-demo-input', template: `
原始值: {{inputValue}}
原始值: {{inputValue1}}
`, styles: [` `] }) export class DemoInputComponent implements OnInit { inputValue = 'xx'; inputValue1 = '测试数据测试数据测试数据测试数据测试数据测试数据测试数据'; inputValue3 = 'xxx3'; @ViewChild('dcPopoverInput') dcPopoverInput; constructor() { } ngOnInit() { } // blur时校验并给输入框赋值样式(是否校验通过) setValid(dom: any, val: any) { if (val) { dom.setInputValid(true); } else { dom.setInputValid(false); } } setValue(val: string) { this.inputValue = val; } modelChange(ev) { console.log(ev); } keyup(ev) { console.log('keyup', ev); } clickEvent(ev) { console.log('click', ev); } }