刷新页面后路由器的Vue.js怪异行为

时间:2019-01-22 16:42:32

标签: vue.js

我的vue.js应用程序中的动态路由存在问题。当我从routerLink进入页面时,单击一切,一切正常。但是,当我刷新该页面或从常规href输入该页面时,该页面的行为很奇怪。看起来好像它没有加载静态资源,例如在public / style.css中重置的样式。此外,组件生命周期方法也不会启动(created(),mounted()等)。

此处复制: 1.输入https://blooming-dusk-66903.herokuapp.com/profiles 2.输入一个配置文件 3.在https://blooming-dusk-66903.herokuapp.com/profiles/ *******

上刷新

这是我的路由器文件


Vue.use(Router);

export default new Router({
  mode: "history",
  routes: [
    {
      path: "/landing",
      name: "Landing",
      component: Landing
    },
    {
      path: "/register",
      name: "RegisterForm",
      component: RegisterForm
    },
    {
      path: "/",
      name: "Dashboard",
      component: Dashboard
    },
    {
      path: "/profile",
      name: "UserProfile",
      component: UserProfile
    },
    {
      path: "/profile/:id",
      name: "Profile",
      component: Profile
    },
    {
      path: "/edit-profile",
      name: "EditProfile",
      component: EditProfile
    },
    {
      path: "/friends",
      name: "Friends",
      component: Friends
    },
    {
      path: "/profiles",
      name: "Profiles",
      component: Profiles
    },
    {
      path: "/friend-requests",
      name: "FriendRequests",
      component: FriendRequests
    },
    {
      path: "/post/:id",
      name: "Post",
      component: Post
    },
    {
      path: "/chat/:handle",
      name: "ChatWith",
      component: ChatWith
    }
  ]
});

0 个答案:

没有答案