error TS2339: Property '$route' does not exist on type

 

<template>
    <div id="app">
        <router-view v-slot="{ Component }">
            <keep-alive>
                <component :is="Component" :key="$route.name" v-if="$route.meta.keepAlive" />
            </keep-alive>
            <component :is="Component" :key="$route.name" v-if="!$route.meta.keepAlive" />
        </router-view>
    </div>
</template>

<script setup lang="ts">
import { useRoute } from 'vue-router'
const $route = useRoute()
</script>

 

posted @ 2023-03-30 05:27  贝尔塔猫  阅读(215)  评论(0编辑  收藏  举报