import { View } from "@tarojs/components";
import style from "./index.module.less";
interface Props {
  checked: boolean;
  onChange: (checked: boolean) => void;
}
const index = ({ checked = false, onChange }: Props) => {

  const handleClick = (e:any) => {
    e.stopPropagation()
    onChange(!checked);
  }
  return (
    <View
      className={checked ? style.switchChecked : style.switch}
      onClick={(e)=> handleClick(e)}
    ></View>
  );
};
export default index;
