# 编辑表单输入框回车事件、输入事件 onKeyPress、表单实时计算

 onInit() {
    this.editFormOptions.forEach(x => {
        x.forEach(option => {
            if (option.field == "字段") {
                option.onKeyPress = $event => {
                    //监听回车事件
                    if ($event.keyCode == 13) {
                        console.log("回车事件") ;
                        return;
                    }

                    setTimeout(() => {
                        console.log(this.editFormFields.字段);
                        //也可给其他字段设置值(实时计算)
                        this.editFormFields.字段1=this.editFormFields.字段2+123
                    }, 100);
                }
            }
        })
    })
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21