点击添加按钮--出现一个框框(类似于添加学习经历-本科-研究生)

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) => (
      
        
         this.changeDescription(e)}
        />
        
)); }; render() { return {taskModel}; } } 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 (
  • {this.state.taskHelper}
  • ); } }

     

    你可能感兴趣的:(javascript)