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>
Logo

前往低代码交流专区

更多推荐