/** * 绘制矢量图 */ import React, { Component } from "react"; import { Row, Col } from "antd"; import "./index.less"; export default class Vectorgraph extends Component { constructor(props) { super(props); this.state = { paintValue: props.paintValue, }; } componentDidMount() {} componentWillReceiveProps(nextPorps) { // console.log(nextPorps) this.setState({ paintValue: nextPorps.paintValue, }); } //把点击的状态值返回给上级 returnParent(selectValue) { this.props.changeSelect(selectValue); } render() { // console.log(this.state.paintValue) return (
{ this.setState({ paintValue: "cancel", }); this.returnParent("cancel"); }} > {/* */}
点选框选
{ this.setState({ paintValue: "circle", }); this.returnParent("circle"); }} >
圆形框选
{ this.setState({ paintValue: "rectangle", }); this.returnParent("rectangle"); }} >
方形框选
{ this.setState({ paintValue: "polygon", }); this.returnParent("polygon"); }} > {/* */}
自定义框选
); } }