33 lines
623 B
Vue
33 lines
623 B
Vue
|
<!--
|
||
|
* @Author: Kane
|
||
|
* @Date: 2022-11-24 09:42:35
|
||
|
* @LastEditors: Kane
|
||
|
* @LastEditTime: 2022-11-24 09:58:11
|
||
|
* @FilePath: \hello-router\src\components\功能页面\路由守卫.vue
|
||
|
* @Description:
|
||
|
*
|
||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||
|
-->
|
||
|
<template>
|
||
|
<h1>路由守卫</h1>
|
||
|
<h1>{{ user.name }}</h1>
|
||
|
</template>
|
||
|
<script>
|
||
|
export default {
|
||
|
name: "route-guard",
|
||
|
data() {
|
||
|
return {
|
||
|
user: {
|
||
|
name: "",
|
||
|
age: 20,
|
||
|
},
|
||
|
};
|
||
|
},
|
||
|
beforeRouteUpdate(to) {
|
||
|
alert(to.params.username);
|
||
|
this.user.name = to.params.username;
|
||
|
},
|
||
|
};
|
||
|
</script>
|
||
|
<style scoped>
|
||
|
</style>
|