dingtalk only
SwitchSwitch 开关
代码示例
import { BfSwitch } from '@bud-fe/react-taro-ui';import { View } from '@tarojs/components';import React, { useState } from 'react';export default () => {const [checked, setChecked] = useState(false);return (<><View className="group-title">基础用法</View><BfSwitch checked={checked} onChange={(v) => setChecked(v)} /><View className="group-title">自定义文案</View><BfSwitch checked yesText="好" /><BfSwitch noText="坏" /></>);};
API
属性名 | 描述 | 类型 | 默认值 |
---|---|---|---|
checked | checked | boolean | -- |
onChange | onChange | (checked: boolean) => void | -- |
disabled | disabled | boolean | false |
yesText | yesText | string | '是' |
noText | noText | string | '否' |