新增 新增、编辑立减金商品,在使用说明中展示限制长度

This commit is contained in:
wangsongsole 2022-06-16 17:53:49 +08:00
parent 029f388c3b
commit 6518594631
2 changed files with 23 additions and 2 deletions

View File

@ -329,3 +329,16 @@
display: none; display: none;
} }
} }
.countBox_par {
position: relative;
display: inline-block;
.countBox {
position: absolute;
color: #999;
bottom: 5%;
z-index: 999999;
right: 3%;
}
}

View File

@ -1,10 +1,12 @@
import React from 'react' import React from 'react'
import Editor from 'wangeditor' import Editor from 'wangeditor'
import './index.less'
export default class wangeditor extends React.Component { export default class wangeditor extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
editorHtml: '' editorHtml: '',
count: 0
} }
} }
componentDidMount() { componentDidMount() {
@ -39,6 +41,7 @@ export default class wangeditor extends React.Component {
self.props.setEdittext(str) self.props.setEdittext(str)
return return
} }
self.setState({ count: text.length })
self.setState({ editorHtml: newHtml }) self.setState({ editorHtml: newHtml })
self.props.setEdittext(newHtml) self.props.setEdittext(newHtml)
} }
@ -49,6 +52,11 @@ export default class wangeditor extends React.Component {
} }
render() { render() {
return <div id='wangeditorDom' style={{ width: this.props.width }}></div> return (
<div className='countBox_par'>
<div id='wangeditorDom' style={{ width: this.props.width }}></div>
<p className='countBox'>{this.state.count + '/' + 500}</p>
</div>
)
} }
} }