From 651859463151171f4d92c9de22c87e38a1973e32 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Thu, 16 Jun 2022 17:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E3=80=81=E7=BC=96=E8=BE=91=E7=AB=8B=E5=87=8F=E9=87=91=E5=95=86?= =?UTF-8?q?=E5=93=81=EF=BC=8C=E5=9C=A8=E4=BD=BF=E7=94=A8=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=E4=B8=AD=E5=B1=95=E7=A4=BA=E9=99=90=E5=88=B6=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/knockGold/index.less | 13 +++++++++++++ src/components/knockGold/wangEditor.jsx | 12 ++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/components/knockGold/index.less b/src/components/knockGold/index.less index 934c56f5..3f878773 100644 --- a/src/components/knockGold/index.less +++ b/src/components/knockGold/index.less @@ -328,4 +328,17 @@ #addNew1 { display: none; } +} + +.countBox_par { + position: relative; + display: inline-block; + + .countBox { + position: absolute; + color: #999; + bottom: 5%; + z-index: 999999; + right: 3%; + } } \ No newline at end of file diff --git a/src/components/knockGold/wangEditor.jsx b/src/components/knockGold/wangEditor.jsx index 9e5eb68e..18fedcfa 100644 --- a/src/components/knockGold/wangEditor.jsx +++ b/src/components/knockGold/wangEditor.jsx @@ -1,10 +1,12 @@ import React from 'react' import Editor from 'wangeditor' +import './index.less' export default class wangeditor extends React.Component { constructor(props) { super(props) this.state = { - editorHtml: '' + editorHtml: '', + count: 0 } } componentDidMount() { @@ -39,6 +41,7 @@ export default class wangeditor extends React.Component { self.props.setEdittext(str) return } + self.setState({ count: text.length }) self.setState({ editorHtml: newHtml }) self.props.setEdittext(newHtml) } @@ -49,6 +52,11 @@ export default class wangeditor extends React.Component { } render() { - return
+ return ( +
+
+

{this.state.count + '/' + 500}

+
+ ) } }