3. 圆角与时间常量
定义了圆角大小和时间相关的常量,方便在界面设计和动画效果中使用。
static readonly BORDER_RADIUS: string = '10vp';
static readonly TIME_DEFAULT_VALUE: number = 0;
static readonly DELAY_SECONDS: number = 0;
static readonly DELAY_SECONDS_FIVE: number = 5;
static readonly INCREMENT_VALUE: number = 1;
static readonly INTERVAL_DELAY: number = 1000;
static readonly INTERVAL_ID_DEFAULT: number = 0;
4. 页面与颜色常量
提供了页面路径、颜色和文本粗细等常量,用于页面导航和界面配色。
static readonly COLUMN_WIDTH: string = '100%';
static readonly COLUMN_HEIGHT: string = '100%';
static readonly NORMAL_TEXT_WEIGHT: number = 500;
static readonly REGULAR_TEXT_WEIGHT: number = 600;
static readonly MEDIUM_TEXT_WEIGHT: number = 700;
static readonly BOLD_TEXT_WEIGHT: number = 800;
static readonly PREFERENCES_FILE_NAME: string = 'btStore';
static readonly PREFERENCES_KEY_PRIVACY: string = 'isPrivacy';
static readonly LAUNCHER_PAGE_TAG: string = 'LauncherPage';
static readonly LAUNCHER_DELAY_TIME: number = 0;
static readonly ADVERTISING_INTERVAL_TIME: number = 1000;
static readonly INPUT_PHONE_LENGTH: number = 11;
static readonly INPUT_PASSWORD_LENGTH: number = 8;
static readonly SPLASH_IMAGES: number = 3;
static readonly MAIN_COLOR: string = '#f54b44';
static readonly SELE_COLOR: string = 'rgb(10, 89, 247)';
static readonly DEF_COLOR: string = 'rgb(51, 51, 51)';
static readonly PRIVACY_POLICY_PAGE_URL: string = 'pages/PrivacyPolicyPage';
static readonly SPLASH_SCREEN_PAGE2: string = 'pages/SplashScreenPage2';
static readonly LOGIN_PAGE_URL: string = 'pages/LoginPage';
5. 图片尺寸常量
定义了图片的宽度和高度常量,便于图片资源的统一管理。
static readonly PIC_WIDTH: number = 24;
static readonly PIC_HEIGHT: number = 24;
static readonly L_PIC_WIDTH: number = 36;
static readonly L_PIC_HEIGHT: number = 36;
在HarmonyOS Next应用开发中,通过合理定义和使用通用常量,可以提高代码的可维护性和可扩展性,使开发过程更加高效和规范。