/** * 绘制矢量图 */ import React, { Component } from "react"; import { Row, Col } from "antd"; import "./index.less"; import { connect } from "dva"; @connect((state) => ({ selectedId: state.command.personList.selectedId })) 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); if (this.props.selectedId) { this.props.dispatch({ type: "command/setPersonSelectIndex", payload: null, }); this.props.dispatch({ type: "command/clearInfoWindow", payload: true, }); } } 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"); }} > {/* */}
自定义框选
); } }