import { Button } from "antd";
import React from "react";
export class Inputt extends React.Component {
constructor(props) {
super(props);
this.state = {
textareaValue: [],//改为数组
bgcolor:'#f00'
}
}
render() {
const buttonOnClick = (e) => {
var state=this.state.textareaValue;
var index=state.findIndex(i=>i==e.currentTarget.value);//找到点击按钮值的下标
if(index==-1){//不存在压入数组
state.push(e.currentTarget.value);
}
else{//存在则移除
state.splice(index,1);
}
this.setState({
textareaValue:state
})
}
const textareaonChange = (e) => {
this.setState({
textareaValue: e.target.value
})
}
function renderButton(words,state){
var btns=[];
for(var v of words)btns.push(<Button style = {{background:state.textareaValue.find(i=>i==v)?state.bgcolor:''}} shape='round' onClick={(e) => buttonOnClick(e) } value={v} key={v}>{v}</Button>)
return btns;
}
var words=['过度授权','重复授权','授权死循环','应用截图与demo不一致','页面无法打开'];
return (
<div>
{renderButton(words,this.state)}
<hr></hr>
<textarea style={{width:500}} value={this.state.textareaValue.join(';')} onChange={(e) => textareaonChange(e)}></textarea>
</div>
)
}
}
approval/getApprovalOpinionTag 这是GET请求,是Button标签( var words=['过度授权','重复授权','授权死循环','应用截图与demo不一致','页面无法打开'];)的
还需要什么,可以给我说下。万分感谢