当前位置:网站首页>Click the Add button - a box appears (similar to adding learning experience - undergraduate - Graduate)
Click the Add button - a box appears (similar to adding learning experience - undergraduate - Graduate)
2022-04-23 05:21:00 【process1212】
import React, { Component } from "react";
class Inner extends Component {
defaultValue = {
taskDescription: "",
vehicleClean: ""
};
constructor() {
super();
this.state = [
{
taskDescription: "",
vehicleClean: ""
}
];
}
changeClean = e => {
let clean = e.target.value;
console.log(this);
this.setState({
vehicleClean: this.state.vehicleClean.concat(clean)
});
console.log(this.state.vehicleClean);
};
changeDescription = e => {
// console.log(e.target.value);
let description = e.target.value;
this.setState({
taskDescription: description
});
};
componentWillMount = () => {
this.showInner();
};
showInner = () => {
this.setState( this.state.push(Object.assign({}, this.defaultValue)));
console.log(result);
taskModel = result.map((item, index) => (
<span key={index}>
<select
name="vehicleClean"
className="vehicle-clean"
onChange={e => this.changeClean(e)}
>
<option value=""> Please select </option>
<option value=" Wash the car "> Wash the car </option>
<option value=" Car rental "> Car rental </option>
<option value=" interior "> interior </option>
<option value=" Wax "> Wax </option>
<option value=" Film "> Film </option>
</select>
<input
type="text"
name="taskDescription"
className="taskZheng"
value={this.state.description}
onChange={e => this.changeDescription(e)}
/>
<br />
</span>
));
};
render() {
return <span>{taskModel}</span>;
}
}
export default class AddTask extends Component {
constructor() {
super();
this.state = {
taskWarn: "",
taskHelper: ""
};
}
addInner = e => {
e.preventDefault();
this.refs.get.showInner();
this.setState({
taskWarn: ""
});
};
render() {
return (
<li>
<label className="title"> Monthly tasks </label>
<div className="table-content">
<div className="task-container">
<Inner ref="get" />
</div>
<button
className="add-button"
id="add-button"
onClick={e => this.addInner(e)}
>
add to
</button>
</div>
<div className="error">
<span id="cleanWarn" className={this.state.taskWarn}>
{this.state.taskHelper}
</span>
</div>
</li>
);
}
}
版权声明
本文为[process1212]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230519446252.html
边栏推荐
- 改进DevSecOps框架的 5 大关键技术
- 日志简介和构建web应用
- MFC implementation resources are implemented separately by DLL
- MySQL circularly adds sequence numbers according to the values of a column
- WTL self drawn control library (cqscheckcomboxbox)
- 2021-09-23
- 使用zerotier让异地设备组局域网
- FileReader API file operation
- 青岛敏捷之旅,来了!
- 《2021年IT行业项目管理调查报告》重磅发布!
猜你喜欢
4 个最常见的自动化测试挑战及应对措施
Unique primary key ID of tidb sub table -- solution to failure of sequence and Gorm to obtain primary key
Graphics.FromImage报错“Graphics object cannot be created from an image that has an indexed pixel ...”
Graphics. Fromimage reports an error "graphics object cannot be created from an image that has an indexed pixel..."
Kanban Quick Start Guide
《2021年IT行业项目管理调查报告》重磅发布!
2021-09-23
Laravel [view]
PIP free export with path (@ file: / / /) notes
mariadb数据库的主从复制
随机推荐
领域驱动模型DDD(三)——使用Saga管理事务
Use of uniapp native plug-ins
Musk and twitter storm drama
2022年最热门的招聘技术技能是什么,您绝对想不到
Master-slave replication of MariaDB database
App Store年交易额100万美元只缴15%佣金,中小开发者心里很矛盾
Three of three JS (webgl) simple sorting of rotation attribute function, and a simple case of rotating around the axis based on this
Streamexecutionenvironment of Flink source code
Laravel routing job
Basic use of sqlyog
configmap
【openh264】cmake: msopenh264-static
varnish入门
Jupyter notebook crawling web pages
Basic theory of Flink
Redis lost key and bigkey
Basic knowledge of vegetable chicken database
To understand Devops, you must read these ten books!
MySQL circularly adds sequence numbers according to the values of a column
Domain driven model DDD (III) -- using saga to manage transactions