相关疑难解决方法(0)

"EventTarget"类型中不存在属性"值"

我使用TypeScript版本2作为Angular 2组件代码.

我收到错误"属性'值'在类型'EventTarget'上不存在"下面的代码,可能是解决方案.谢谢!

e.target.value.match(/\S +/g)|| []).长度

import { Component, EventEmitter, Output } from '@angular/core';

@Component({
selector: 'text-editor',
template: `
<textarea (keyup)="emitWordCount($event)"></textarea>
 `
 })
  export class TextEditorComponent {
   @Output() countUpdate = new EventEmitter<number>();

emitWordCount(e: Event) {
    this.countUpdate.emit(
        (e.target.value.match(/\S+/g) || []).length);
}
}
Run Code Online (Sandbox Code Playgroud)

typescript angular

69
推荐指数
11
解决办法
4万
查看次数

标签 统计

angular ×1

typescript ×1