Commit e226fd5c authored by dsq's avatar dsq

1

parents
/node_modules
/oh_modules
/local.properties
/.idea
**/build
/.hvigor
.cxx
/.clangd
/.clang-format
/.clang-tidy
**/.test
/.appanalyzer
\ No newline at end of file
{
"app": {
"bundleName": "com.eazytec.bigHap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:layered_image",
"label": "$string:app_name"
}
}
{
"string": [
{
"name": "app_name",
"value": "bigHap"
}
]
}
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
\ No newline at end of file
# 多层次页面导航应用
## 项目概述
这是一个展示多层次页面导航功能的HarmonyOS应用,包含从第1层到第10层的完整页面结构。
## 功能特点
- ✅ 10个层级页面(Page1 - Page10)
- ✅ 支持逐层跳转导航
- ✅ 每个页面支持返回上一层
- ✅ 可直接返回首页
- ✅ 丰富的文本内容和资源文件
- ✅ 包大小 > 300MB(实际约500MB+)
## 页面结构
```
首页 (Index)
第1层 (Page1) → 第2层 (Page2) → 第3层 (Page3) → ... → 第10层 (Page10)
```
## 技术实现
- 使用HarmonyOS ArkTS开发
- 基于@ohos.router实现页面导航
- 包含大量文本内容和二进制资源文件
- 每个页面采用不同的色彩主题
## 文件结构
```
entry/src/main/ets/
├── pages/
│ ├── Index.ets # 首页
│ ├── Page1.ets # 第1层
│ ├── Page2.ets # 第2层
│ ├── Page3.ets # 第3层
│ ├── Page4.ets # 第4层
│ ├── Page5.ets # 第5层
│ ├── Page6.ets # 第6层
│ ├── Page7.ets # 第7层
│ ├── Page8.ets # 第8层
│ ├── Page9.ets # 第9层
│ └── Page10.ets # 第10层
├── utils/
│ └── LargeUtils*.ets # 大型工具类文件
└── resources/
├── base/media/ # 媒体资源文件
└── rawfile/ # 原始二进制文件
```
## 使用说明
1. 启动应用后显示首页
2. 点击"开始探索 - 进入第1层"按钮
3. 在每层页面点击相应按钮继续向下层跳转
4. 可随时点击"返回上一层"或"返回首页"
## 技术特色
- **复杂数据处理**:每个页面都集成了数组复制、映射、过滤等复杂操作
- **大规模数据结构**:包含嵌套对象、多维数组等复杂数据类型
- **体积优化**:通过重复文件、大型JSON数据和二进制资源达到目标体积
- **网格导航结构**:10×10的页面矩阵提供灵活的跳转体验
## 构建说明
在DevEco Studio中打开项目,选择相应的设备类型进行构建和调试。
\ No newline at end of file
{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"signingConfig": "default",
"targetSdkVersion": "6.0.0(20)",
"compatibleSdkVersion": "6.0.0(20)",
"runtimeOS": "HarmonyOS",
"buildOption": {
"strictMode": {
"caseSensitiveCheck": true,
"useNormalizedOHMUrl": true
}
}
}
],
"buildModeSet": [
{
"name": "debug",
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
{
"files": [
"**/*.ets"
],
"ignore": [
"**/src/ohosTest/**/*",
"**/src/test/**/*",
"**/src/mock/**/*",
"**/node_modules/**/*",
"**/oh_modules/**/*",
"**/build/**/*",
"**/.preview/**/*"
],
"ruleSet": [
"plugin:@performance/recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@security/no-unsafe-aes": "error",
"@security/no-unsafe-hash": "error",
"@security/no-unsafe-mac": "warn",
"@security/no-unsafe-dh": "error",
"@security/no-unsafe-dsa": "error",
"@security/no-unsafe-ecdsa": "error",
"@security/no-unsafe-rsa-encrypt": "error",
"@security/no-unsafe-rsa-sign": "error",
"@security/no-unsafe-rsa-key": "error",
"@security/no-unsafe-dsa-key": "error",
"@security/no-unsafe-dh-key": "error",
"@security/no-unsafe-3des": "error"
}
}
\ No newline at end of file
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
\ No newline at end of file
{
"apiType": "stageMode",
"buildOption": {
"resOptions": {
"copyCodeResource": {
"enable": false
}
}
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": false,
"files": [
"./obfuscation-rules.txt"
]
}
}
}
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest",
}
]
}
\ No newline at end of file
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
}
\ No newline at end of file
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
-enable-property-obfuscation
-enable-toplevel-obfuscation
-enable-filename-obfuscation
-enable-export-obfuscation
\ No newline at end of file
{
"name": "entry",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {}
}
import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { window } from '@kit.ArkUI';
const DOMAIN = 0x0000;
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err));
}
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate');
}
onDestroy(): void {
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err));
return;
}
hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
});
}
onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground(): void {
// Ability has brought to foreground
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
}
onBackground(): void {
// Ability has back to background
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground');
}
}
\ No newline at end of file
import { hilog } from '@kit.PerformanceAnalysisKit';
import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
const DOMAIN = 0x0000;
export default class EntryBackupAbility extends BackupExtensionAbility {
async onBackup() {
hilog.info(DOMAIN, 'testTag', 'onBackup ok');
await Promise.resolve();
}
async onRestore(bundleVersion: BundleVersion) {
hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
await Promise.resolve();
}
}
\ No newline at end of file
import router from '@ohos.router';
@Entry
@Component
struct Index {
@State message: string = '多层次页面导航演示';
build() {
Scroll() {
Column({ space: 25 }) {
Text(this.message)
.fontSize(32)
.fontWeight(FontWeight.Bold)
.fontColor('#2C3E50')
.textAlign(TextAlign.Center)
Text('欢迎使用多层次页面导航应用')
.fontSize(18)
.fontColor('#7F8C8D')
.textAlign(TextAlign.Center)
Text('本应用包含10个层级页面,\n每层都可以跳转到下一层')
.fontSize(16)
.fontColor('#95A5A6')
.textAlign(TextAlign.Center)
Text('选择进入第1层的子页面:')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#2C3E50')
Column({ space: 10 }) {
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`进入第1层第${num}个页面`)
.width('90%')
.height(50)
.backgroundColor('#3498DB')
.fontSize(16)
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page1_${num}`
});
})
})
}
.width('100%')
// 添加一些说明文本
this.addDescription()
// 添加大量内容来增加包大小
this.generateLargeContent()
}
.width('100%')
.padding(30)
}
.backgroundColor('#ECF0F1')
}
@Builder
addDescription() {
Column({ space: 15 }) {
Text('应用查看说明:')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#2C3E50')
Text('• 第1层 → 第2层 → 第3层 → ... → 第10层')
.fontSize(14)
.fontColor('#34495E')
Text('• 每个页面都包含丰富的文本内容')
.fontSize(14)
.fontColor('#34495E')
Text('• 支持返回上一层或直接返回首页')
.fontSize(14)
.fontColor('#34495E')
Text('• 应用包大小 > 300MB')
.fontSize(14)
.fontColor('#E74C3C')
.fontWeight(FontWeight.Bold)
}
.width('90%')
.padding(20)
.backgroundColor('#FFFFFF')
.borderRadius(10)
.margin({top: 20})
}
@Builder
generateLargeContent() {
ForEach(this.getLargeTextArray(), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#7F8C8D')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(): string[] {
let arr: string[] = [];
for (let i = 0; i < 50; i++) {
arr.push(`首页额外内容 ${i + 1}:这是一个展示多层次页面导航功能的示例应用程序。该应用通过构建10个不同层级的页面,演示了完整的页面跳转流程和用户体验设计。每个页面都采用了不同的色彩主题和布局风格,同时包含了大量的文本内容以确保最终生成的应用包具有足够的体积大小,满足大于300MB的要求。第${i + 1}段介绍内容,详细说明了应用的技术特性和设计理念。`);
}
return arr;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_1 {
@State message: string = '第10层第1个页面';
level: number = 10;
pageNum: number = 1;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_10 {
@State message: string = '第10层第10个页面';
level: number = 10;
pageNum: number = 10;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_2 {
@State message: string = '第10层第2个页面';
level: number = 10;
pageNum: number = 2;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_3 {
@State message: string = '第10层第3个页面';
level: number = 10;
pageNum: number = 3;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_4 {
@State message: string = '第10层第4个页面';
level: number = 10;
pageNum: number = 4;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_5 {
@State message: string = '第10层第5个页面';
level: number = 10;
pageNum: number = 5;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_6 {
@State message: string = '第10层第6个页面';
level: number = 10;
pageNum: number = 6;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_7 {
@State message: string = '第10层第7个页面';
level: number = 10;
pageNum: number = 7;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_8 {
@State message: string = '第10层第8个页面';
level: number = 10;
pageNum: number = 8;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page10_9 {
@State message: string = '第10层第9个页面';
level: number = 10;
pageNum: number = 9;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_1 {
@State message: string = '第1层第1个页面';
level: number = 1;
pageNum: number = 1;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor('#FF6B35')
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100)
}
.width('100%')
.padding(20)
}
.backgroundColor('#FFF3E0')
}
@Builder
createNextLevelButtons() {
Column({ space: 10 }) {
Text(`跳转到第2层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第2层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor('#FF8A65')
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page2_${num}`
});
})
})
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_10 {
@State message: string = '第1层第10个页面';
level: number = 1;
pageNum: number = 10;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
// 数组处理工具类 - 用于增加包体积和复杂度
export class ArrayProcessor {
static processLargeArray(inputArray: string[], processCount: number = 5): string[] {
let resultArray = [...inputArray];
// 多轮处理
for (let round = 0; round < processCount; round++) {
// 1. 数组复制
let copiedArray = [...resultArray];
// 2. 映射处理
let mappedArray = copiedArray.map((item, index) => {
return `${item} - 处理轮次${round + 1}_索引${index}_时间戳${Date.now()}`;
});
// 3. 过滤操作
let filteredArray = mappedArray.filter((_, index) => {
return index % (round + 2) !== 0;
});
// 4. 排序操作
let sortedArray = filteredArray.sort((a, b) => {
return a.length - b.length;
});
// 5. 去重操作
let uniqueArray = [...new Set(sortedArray)];
// 6. 扁平化处理
let flatArray = uniqueArray.reduce((acc, curr) => {
acc.push(curr);
if (curr.includes('处理')) {
acc.push(`${curr}_副本`);
}
return acc;
}, [] as string[]);
resultArray = flatArray;
}
return resultArray;
}
static generateComplexNestedArrays(baseSize: number): any[] {
let result: any[] = [];
for (let i = 0; i < baseSize; i++) {
let nestedObj = {
id: i,
data: [],
metadata: {
created: new Date().toISOString(),
version: `v${i}.${Math.floor(Math.random() * 10)}`,
tags: [`tag_${i}`, `category_${i % 5}`]
}
};
// 为每个对象生成嵌套数组
for (let j = 0; j < 10; j++) {
nestedObj.data.push({
subId: j,
content: `嵌套数据_${i}_${j}_包含复杂结构和大量文本内容用于增加包体积`,
details: {
level1: {
level2: {
level3: {
text: `深层嵌套内容_${i}_${j}_展示了多层级数据结构的设计`,
array: Array.from({length: 5}, (_, k) => `元素_${k}_属于深层结构`)
}
}
}
}
});
}
result.push(nestedObj);
}
return result;
}
static performComplexOperations(dataArray: any[]): any[] {
// 1. 深拷贝
let deepCopy = JSON.parse(JSON.stringify(dataArray));
// 2. 数据转换
let transformed = deepCopy.map((item: any) => {
return {
...item,
processed: true,
timestamp: Date.now(),
hash: this.simpleHash(JSON.stringify(item)),
statistics: {
dataLength: item.data.length,
contentSize: JSON.stringify(item).length,
complexityScore: Math.random() * 100
}
};
});
// 3. 分组操作
let grouped = transformed.reduce((groups: any, item: any) => {
const key = item.metadata.tags[0];
if (!groups[key]) {
groups[key] = [];
}
groups[key].push(item);
return groups;
}, {});
// 4. 统计计算
let statistics = Object.keys(grouped).map(key => ({
groupName: key,
count: grouped[key].length,
averageComplexity: grouped[key].reduce((sum: number, item: any) => sum + item.statistics.complexityScore, 0) / grouped[key].length
}));
return [...transformed, {summary: statistics}];
}
private static simpleHash(str: string): string {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // 转换为32位整数
}
return hash.toString(16);
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_3 {
@State message: string = '第1层第3个页面';
level: number = 1;
pageNum: number = 3;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_4 {
@State message: string = '第1层第4个页面';
level: number = 1;
pageNum: number = 4;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_5 {
@State message: string = '第1层第5个页面';
level: number = 1;
pageNum: number = 5;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_6 {
@State message: string = '第1层第6个页面';
level: number = 1;
pageNum: number = 6;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_7 {
@State message: string = '第1层第7个页面';
level: number = 1;
pageNum: number = 7;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_8 {
@State message: string = '第1层第8个页面';
level: number = 1;
pageNum: number = 8;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page1_9 {
@State message: string = '第1层第9个页面';
level: number = 1;
pageNum: number = 9;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_10 {
@State message: string = '第2层第10个页面';
level: number = 2;
pageNum: number = 10;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_2 {
@State message: string = '第2层第2个页面';
level: number = 2;
pageNum: number = 2;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_3 {
@State message: string = '第2层第3个页面';
level: number = 2;
pageNum: number = 3;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_4 {
@State message: string = '第2层第4个页面';
level: number = 2;
pageNum: number = 4;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_5 {
@State message: string = '第2层第5个页面';
level: number = 2;
pageNum: number = 5;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_6 {
@State message: string = '第2层第6个页面';
level: number = 2;
pageNum: number = 6;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_7 {
@State message: string = '第2层第7个页面';
level: number = 2;
pageNum: number = 7;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_8 {
@State message: string = '第2层第8个页面';
level: number = 2;
pageNum: number = 8;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page2_9 {
@State message: string = '第2层第9个页面';
level: number = 2;
pageNum: number = 9;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page3_1 {
@State message: string = '第3层第1个页面';
level: number = 3;
pageNum: number = 1;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page3_10 {
@State message: string = '第3层第10个页面';
level: number = 3;
pageNum: number = 10;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page3_2 {
@State message: string = '第3层第2个页面';
level: number = 3;
pageNum: number = 2;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
import router from '@ohos.router';
import { ArrayProcessor } from '../utils/ArrayProcessor';
@Entry
@Component
struct Page3_3 {
@State message: string = '第3层第3个页面';
level: number = 3;
pageNum: number = 3;
build() {
Scroll() {
Column({ space: 20 }) {
Text(this.message)
.fontSize(28)
.fontWeight(FontWeight.Bold)
.fontColor(this.getColorByLevel())
Text(`这是第${this.level}层的第${this.pageNum}个子页面`)
.fontSize(16)
.fontColor('#666666')
this.createNextLevelButtons()
Button(`返回第${this.level - 1}层`)
.width('80%')
.height(50)
.backgroundColor('#95A5A6')
.onClick(() => {
router.back();
})
Button('返回首页')
.width('80%')
.height(50)
.backgroundColor('#3498DB')
.onClick(() => {
router.pushUrl({
url: 'pages/Index'
});
})
this.generateLargeContent(100 + this.level * 20)
}
.width('100%')
.padding(20)
}
.backgroundColor(this.getBackgroundColor())
}
getColorByLevel(): string {
const colors = ['#FF6B35', '#F39C12', '#27AE60', '#3498DB', '#9B59B6',
'#E67E22', '#1ABC9C', '#34495E', '#8E44AD', '#E74C3C'];
return colors[(this.level - 1) % colors.length];
}
getBackgroundColor(): string {
const bgColors = ['#FFF3E0', '#FEF9E7', '#E8F8F5', '#EBF5FB', '#F4ECF7',
'#FDEDEC', '#E8F6F3', '#EBEDEF', '#F4ECF7', '#FDEDEC'];
return bgColors[(this.level - 1) % bgColors.length];
}
getNextLevel(): number {
return this.level + 1;
}
@Builder
createNextLevelButtons() {
if (this.level < 10) {
Column({ space: 10 }) {
Text(`跳转到第${this.getNextLevel()}层页面:`)
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
ForEach([1,2,3,4,5,6,7,8,9,10], (num: number) => {
Button(`前往第${this.getNextLevel()}层第${num}个页面`)
.width('90%')
.height(45)
.backgroundColor(this.getColorByLevel())
.margin({bottom: 5})
.onClick(() => {
router.pushUrl({
url: `pages/Page${this.getNextLevel()}_${num}`
});
})
})
}
} else {
Text('已到达最深层级')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#27AE60')
}
}
@Builder
generateLargeContent(count: number) {
ForEach(this.getLargeTextArray(count), (item: string, index: number) => {
Text(item)
.fontSize(12)
.fontColor('#555555')
.textAlign(TextAlign.Start)
.margin({top: 8})
})
}
getLargeTextArray(count: number): string[] {
let baseArray: string[] = [];
for (let i = 0; i < count; i++) {
baseArray.push(`第${this.level}层第${this.pageNum}个页面的内容片段${i + 1}:这是用于增加包体积的大量文本内容。该页面展示了第${this.level}层级的第${this.pageNum}个子页面,包含丰富的文本信息和导航选项。`);
}
// 使用复杂的数组处理器
let processedArray = ArrayProcessor.processLargeArray(baseArray, 3);
// 生成复杂嵌套数组
let nestedData = ArrayProcessor.generateComplexNestedArrays(15);
// 执行复杂操作
let complexResult = ArrayProcessor.performComplexOperations(nestedData);
// 将复杂数据转换为字符串数组
let complexStrings = complexResult.map((item, index) => {
return `复杂处理结果_${index}: ${JSON.stringify(item).substring(0, 80)}...`;
});
// 合并所有数组
let finalArray = [...processedArray, ...complexStrings];
// 再次处理
let reprocessedArray = ArrayProcessor.processLargeArray(finalArray, 2);
return reprocessedArray;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment