import { Switch, View } from "@tarojs/components";
import Taro from "@tarojs/taro";
import { classNames } from "../../lib";
import { IProps } from "../../../@types/switch";
import ClSwitch_h5 from "./h5";
export default function ClSwitch(props: IProps) {
const title = props.title;
const color = props.color || "green";
const shapeClassName = props.shape !== "radius" ? "" : "radius";
const type = props.type === "form" ? "form" : "normal";
const checked = !!props.checked;
const hasChecked = checked ? "checked" : "";
const onChange = e => {
props.onChange && props.onChange(e.detail.value);
};
const switchComponent = (
);
const formSwitchComponent = (
{title}
{switchComponent}
);
return Taro.getEnv() === Taro.ENV_TYPE.WEB ? (
) : type === "form" ? (
formSwitchComponent
) : (
switchComponent
);
}
ClSwitch.options = {
addGlobalClass: true
};