clearError
clearError 可组合函数用于清除所有已处理的错误。
在你的页面、组件和插件中,你可以使用 clearError
清除所有错误并重定向用户。
¥Within your pages, components, and plugins, you can use clearError
to clear all errors and redirect the user.
参数:
¥Parameters:
options?: { redirect?: string }
你可以提供一个可选的重定向路径(例如,如果你想导航到 'safe' 页面)。
¥You can provide an optional path to redirect to (for example, if you want to navigate to a 'safe' page).
// Without redirect
clearError()
// With redirect
clearError({ redirect: '/homepage' })
使用 useError()
设置状态中的错误。clearError
可组合项将重置此状态,并使用提供的选项调用 app:error:cleared
钩子。
¥Errors are set in state using useError()
. The clearError
composable will reset this state and calls the app:error:cleared
hook with the provided options.