import React,{Component} from 'react'; import classNames from 'classnames'; import style from "./index.less"; /**** * 主诉常见症状下拉 * 接收参数: * data: json数组 * show:true/false * textKey: 选项文字字段名 * idKey: 选项id字段名 * type: text选项为纯文本,label选项为标签 * onSelect: 选中事件 * * ***/ class CommonSymptom extends Component{ constructor(props){ super(props); this.handleSelect = this.handleSelect.bind(this); } getClass(){ let name = style['text-list']; let isHide = this.props.show?'':style['hide']; switch (this.props.type){ case 'text': name = style['text-list']; break; case 'label': name = style['label-list']; break; default: name = style['text-list']; } return classNames(style['list'],name,isHide); } handleSelect(e,item){ e.stopPropagation(); const {onSelect,onShow} = this.props; onSelect&&onSelect(item); // onShow&&onShow(e,false); } render(){ const {data} = this.props; return
} } export default CommonSymptom;