API middleware属性
讲解关于API: middleware的使用例子。
在应用中的特定设置中间件
例子:
<template> <h1>Secret page</h1> </template> <script> export default { middleware: 'authenticated' } </script>
export default function ({ store, redirect }) { // If the user is not authenticated if (!store.state.authenticated) { return redirect('/login') } }
想了解更多关于使用中间件的信息,请移步查看中间件指引。