import Taro from "@tarojs/taro"; import classnames from "classnames"; import { Block, View, Image, Text, CoverView } from "@tarojs/components"; import { useState, useEffect } from "react"; import "./index.less"; interface Props { isShowNurse: boolean; isStopNurse: boolean; isDisabled: boolean; // 是否禁用开始暂停按钮:模式与连接设备是否一致 onEmitStartNurse: Function; // 每次点击item,回调事件和数据给父组件 onEmitSwitchChange: Function; onEmitEndPlan: Function; onEmitErrorTips: Function; // 不可点击,提示错误 } function Index({ isShowNurse, isStopNurse, isDisabled, onEmitStartNurse, onEmitSwitchChange, onEmitEndPlan, onEmitErrorTips, }: Props) { const onStartNurse = () => { onEmitStartNurse(); }; const onSwitchChange = () => { if (!isDisabled) { onEmitSwitchChange(); } }; const onEndPlan = () => { onEmitEndPlan(); }; const onErrorTips = () => { onEmitErrorTips(); }; return ( {!isShowNurse && ( {isDisabled ? ( 开始护理 ) : ( 开始护理 )} )} {isShowNurse && ( {!isDisabled && ( {isStopNurse ? ( 启动光照 ) : ( 暂停光照 )} )} {isDisabled && ( {isStopNurse ? ( 启动光照 ) : ( 暂停光照 )} )} 结束护理 )} ); } export default Index;