diff --git a/pages.json b/pages.json
index 3da89a6c60bf54cdaa12b1aed893f4f14ee79aae..0b25dc52bbe2270174a9cac2aec4a614c16d6b7f 100644
--- a/pages.json
+++ b/pages.json
@@ -764,6 +764,18 @@
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
+ },
+ {
+ "path": "pages/error/runtime-error/runtime-error-options",
+ "style": {
+ "navigationBarTitleText": "runtime error 选项式 API"
+ }
+ },
+ {
+ "path": "pages/error/runtime-error/runtime-error-composition",
+ "style": {
+ "navigationBarTitleText": "runtime error 组合式 API"
+ }
}
],
"globalStyle": {
diff --git a/pages/error/runtime-error/runtime-error-composition.uvue b/pages/error/runtime-error/runtime-error-composition.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..5a9285795020628771ad7c4a407c34620f078668
--- /dev/null
+++ b/pages/error/runtime-error/runtime-error-composition.uvue
@@ -0,0 +1,9 @@
+
+
+ {{ arr[1] }}
+
+
+
+
diff --git a/pages/error/runtime-error/runtime-error-options.uvue b/pages/error/runtime-error/runtime-error-options.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..690760e45b2487e815f94464b44b21edea305b95
--- /dev/null
+++ b/pages/error/runtime-error/runtime-error-options.uvue
@@ -0,0 +1,15 @@
+
+
+ {{ arr[1] }}
+
+
+
+
diff --git a/pages/error/runtime-error/runtime-error.test.js b/pages/error/runtime-error/runtime-error.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..3b882713b8551eb73c56309a2d9bc161b8e847aa
--- /dev/null
+++ b/pages/error/runtime-error/runtime-error.test.js
@@ -0,0 +1,21 @@
+const OPTIONS_PAGE_PATH = '/pages/error/runtime-error/runtime-error-options'
+const COMPOSITION_PAGE_PATH = '/pages/error/runtime-error/runtime-error-composition'
+const HOME_PAGE = '/pages/index/index'
+
+describe('运行时异常', () => {
+ let page
+ const test = async (pagePath) => {
+ page = await program.reLaunch(pagePath)
+ await page.waitFor(1000)
+ expect(page.path).toBe(pagePath.substring(1))
+ page = await program.navigateTo(HOME_PAGE)
+ await page.waitFor(1000)
+ expect(page.path).toBe(HOME_PAGE.substring(1))
+ }
+ it('数组下标越位 options API', async () => {
+ await test(OPTIONS_PAGE_PATH)
+ })
+ it('数组下标越位 composition API', async () => {
+ await test(COMPOSITION_PAGE_PATH)
+ })
+})
diff --git a/pages/index/index.uvue b/pages/index/index.uvue
index f4acdb5ff2743ea7794c73830b39f61e642b4446..c1c9225eb6171cf9409ec8d10f6e05c9a657cbce 100644
--- a/pages/index/index.uvue
+++ b/pages/index/index.uvue
@@ -884,6 +884,28 @@ export default {
]
}
] as Page[]
+ },
+ {
+ id: 'error',
+ name: '异常示例',
+ pages: [
+ {
+ id: 'runtime-error',
+ name: '运行时异常',
+ children: [
+ {
+ id: 'runtime-error-options',
+ name: '运行时异常 选项式 API',
+ url: 'runtime-error-options'
+ },
+ {
+ id: 'runtime-error-composition',
+ name: '运行时异常 组合式 API',
+ url: 'runtime-error-composition'
+ },
+ ]
+ }
+ ]
}
] as Menu[]
}