vue3点击哪个路由,就获取哪个路由的名称
router上要定义meta{path: '/home',name: 'Home',component: () => import('@/views/filmprocess/home/Index.vue'),meta: {title: '用户管理',requiresAuth: true}},{path: '/login',
·
router上要定义meta
{
path: '/home',
name: 'Home',
component: () => import('@/views/filmprocess/home/Index.vue'),
meta: {
title: '用户管理',
requiresAuth: true
}
},
{
path: '/login',
name: 'Login',
component: () => import('@/views/login/Index.vue'),
meta: {
title: '登录'
}
},
页面引入route并使用
<template>
<div class="left-name">
<span>{{ Route.meta.title }}</span>
</div>
</template>
<script setup lang="ts">
import { useRoute } from 'vue-router';
const Route = useRoute();
</script>
更多推荐
已为社区贡献6条内容
所有评论(0)