提交 cbc761d9 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat: 补充 onError 示例

上级 cd3bd3aa
......@@ -64,6 +64,9 @@
console.log('App Exit')
},
// #endif
onError: function(error: any) {
console.log('App Error', error)
},
methods: {
checkLaunchPath() : boolean {
const HOME_PATH = 'pages/index/index'
......
......@@ -842,6 +842,18 @@
"style": {
"navigationBarTitleText": "runtime error 组合式 API"
}
},
{
"path": "pages/error/throw-error/throw-error-options",
"style": {
"navigationBarTitleText": "throw error 选项式 API"
}
},
{
"path": "pages/error/throw-error/throw-error-composition",
"style": {
"navigationBarTitleText": "throw error 组合式 API"
}
}
],
"globalStyle": {
......
<template>
<view class="page">
<button @click="triggerError">trigger error</button>
</view>
</template>
<script setup lang="uts">
onReady(() => {
throw Error('error in error composition page onReady')
})
const triggerError = () => {
throw Error('trigger error in throw error composition page')
}
</script>
<template>
<view class="page">
<button @click="triggerError">trigger error</button>
</view>
</template>
<script lang="uts">
export default {
onReady(){
throw Error('error in error options page onReady')
},
methods: {
triggerError(){
throw Error('trigger error in throw error options page')
}
},
}
</script>
......@@ -1164,6 +1164,22 @@ export default {
url: 'runtime-error-composition'
},
]
},
{
id: 'throw-error',
name: 'throw error',
children: [
{
id: 'throw-error-options',
name: 'throw error 选项式 API',
url: 'throw-error-options'
},
{
id: 'throw-error-composition',
name: 'throw error 组合式 API',
url: 'throw-error-composition'
},
]
}
]
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册