From 3bef4802426599921497ec31d3c338afc6bdbdb4 Mon Sep 17 00:00:00 2001 From: 18652063575 Date: Thu, 27 Oct 2022 10:29:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/salaryItem/formalFormModal.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js b/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js index 27176264..c79eff3d 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js @@ -80,12 +80,13 @@ export default class FormalFormModal extends React.Component { const str = propsTextarea.value.substring(end - 1, end); if (str === "}") { const index = propsTextarea.value.lastIndexOf("{", end - 1); - const currentValue = propsTextarea.value.substring(index, end); + const currentValue = propsTextarea.value.substring(index + 1, end); + console.log(currentValue); + console.log(propsTextarea.value.replace(currentValue, "")); this.setState({ value: propsTextarea.value.replace(currentValue, "") },()=>{ - console.log(this.state.value); - propsTextarea.value= 'this.state.value'; + propsTextarea.value= this.state.value; }); } } @@ -109,13 +110,12 @@ export default class FormalFormModal extends React.Component { // 多行文本编辑 handleChange(value) { - console.log(value); if (value && value.trim() == "") { this.parameters = []; } - // this.setState({ - // value - // }); + this.setState({ + value + }); } // 获取光标位置 @@ -290,7 +290,8 @@ export default class FormalFormModal extends React.Component { ref={(input) => this.contentProps = input} minRows={8} maxRows={8} - // value={value} onChange={(value) => this.handleChange(value)} + value={value} + onChange={(value) => this.handleChange(value)} noResize={true} style={{ fontSize: "14px", lineHeight: 1.2 }} onKeyDown={this.triggerKeyDown}