index.jsx 895 B

1234567891011121314151617181920212223242526272829303132
  1. import React, { Component } from "react";
  2. import style from './index.less'
  3. import classNames from 'classnames';
  4. import more from '@common/images/addItem1.png';
  5. /**
  6. 添加组件,如添加检验项
  7. **/
  8. class Add extends Component {
  9. constructor(props){
  10. super(props);
  11. this.handleClick = this.handleClick.bind(this);
  12. }
  13. handleClick(e){
  14. // e.stopPropagation(); //冒泡到最顶层关闭其他下拉
  15. const {handleClick} = this.props;
  16. handleClick && handleClick(e);
  17. }
  18. render(){
  19. const {showText,handleClick,id,height} = this.props;
  20. return <div className={style['tag-container']} onClick={(e)=>{this.handleClick(e)}} id={id}>
  21. <img src={more} style={{verticalAlign:'middle'}}/>
  22. <span className={`inline-box ${style['gray']}`} style={{height:height?height:'',lineHeight:height?height:''}}>{showText}</span>
  23. </div>
  24. }
  25. }
  26. export default Add;