29 lines
792 B
TypeScript
29 lines
792 B
TypeScript
import { View, Text } from '@tarojs/components';
|
|
|
|
type WechatLoginButtonProps = {
|
|
loading?: boolean;
|
|
disabled?: boolean;
|
|
/** 默认「授权登录」,避免使用「微信」字样与官方风格图标 */
|
|
label?: string;
|
|
onClick: () => void;
|
|
};
|
|
|
|
/** 授权登录按钮(无微信品牌元素,满足小程序审核) */
|
|
export default function WechatLoginButton({
|
|
loading = false,
|
|
disabled = false,
|
|
label = '授权登录',
|
|
onClick,
|
|
}: WechatLoginButtonProps) {
|
|
const inactive = loading || disabled;
|
|
|
|
return (
|
|
<View
|
|
className={`login-wechat-btn${inactive ? ' login-wechat-btn--disabled' : ''}`}
|
|
onClick={inactive ? undefined : onClick}
|
|
>
|
|
<Text className="login-wechat-btn__text">{loading ? '授权中...' : label}</Text>
|
|
</View>
|
|
);
|
|
}
|