我有以下 App.vue 文件:
以及以下路由器文件:
import { createRouter, createWebHistory } from "vue-router";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: "/",
name: "signin",
component: () => import("../views/signin.vue"),
},
{
path: "/dashboard",
name: "dashboard",
component: () => import("../views/dashboard.vue"),
},
],
});
export default router;
当我运行应用程序并单击任何链接时,无论使用 $router.push("/dashboard"); 或 router-link(to ="/dashboard" active-class="active")。我已经检查了许多其他问题和教程,但不幸的是它仍然不起作用。知道为什么没有发生转换吗?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
更改:
至
转换没有检测到视图的变化,因此您需要提供一些可以改变的内容。 另外,请记住
fade必须是 CSS 中的实际动画,例如:.fade-enter-active { animation: fade 0.25s; } .fade-leave-active { animation: fade 0.25s reverse; } @keyframes fade { from { opacity: 0%; } to { opacity: 100%; } }