import React, { Component } from "react";
import style from "../index.less";
import down from "@common/images/show.png";
import ReactDom from "react-dom";

class RotateImg extends Component {
  constructor(props){
    super(props);
    this.state={
      de:0
    }
  }
  componentDidMount() {
    setTimeout(() => {

    }, 0);
  }
  xunzhaun(flg){
    console.log(this.refs.rotateImg.getDOMNode())
    let de = this.state.de;
    if(flg){
        de = de-90
    }else{
        de = de-0+90
    }
    de=parseInt(de)
    // $("#img_id").css("transform", "translateX(-50%) translateY(-50%) rotate(" + de + "deg)" );
    // $("#img_id").attr("de", de);
  }
  render() {
    const { src } = this.props;
    const domNode = document.getElementById('root');
    return ReactDom.createPortal(<div className={style.preImgWrap}>
      <img className={style.rotateImg} src={src} ref="rotateImg" alt=""/>
      <img className={style.rotate} src={down} alt="图片旋转"/>
    </div>,domNode)
  }
}

export default RotateImg;
