refactor(mp): E3-2 大文件拆分 + U3-2 微交互统一
E3-2 大文件拆分(3 文件 → 6 文件): - daily-monitoring 449L → useDailyMonitoring.ts hook(238L) + 页面(255L) - request.ts 376L → cache.ts(75L) + limiter.ts(32L) + 主文件(278L) - BLEManager.ts 363L → BLEConnection.ts(212L) + 主文件(228L) U3-2 微交互统一: - 新增 haptic.ts 工具(light/medium/heavy 三级触觉反馈) - PrimaryButton 点击触发 hapticLight() - tokens.scss 新增 5 个动画时序 token(duration/easing) - mixins.scss 新增 fade-in() mixin(支持 fast/normal/slow 三档)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import { hapticLight } from '@/utils/haptic';
|
||||
import './index.scss';
|
||||
|
||||
interface PrimaryButtonProps {
|
||||
@@ -27,8 +28,14 @@ const PrimaryButton: React.FC<PrimaryButtonProps> = ({
|
||||
className,
|
||||
].filter(Boolean).join(' ');
|
||||
|
||||
const handleClick = () => {
|
||||
if (disabled || loading) return;
|
||||
hapticLight();
|
||||
onClick?.();
|
||||
};
|
||||
|
||||
return (
|
||||
<View className={cls} role="button" aria-disabled={disabled} aria-busy={loading} onClick={!disabled && !loading ? onClick : undefined}>
|
||||
<View className={cls} role="button" aria-disabled={disabled} aria-busy={loading} onClick={handleClick}>
|
||||
{loading && <View className='primary-btn__spinner' />}
|
||||
<Text className='primary-btn__text'>{children}</Text>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user