您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

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')
  }
}

想了解更多关于使用中间件的信息,请移步查看中间件指引。


联系我
置顶