Vue 重定向和别名
Posted dzkjz
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Vue 重定向和别名相关的知识,希望对你有一定的参考价值。
index.js:
import VueRouter from "vue-router"; import UserSettings from "./UserSettings"; import UserEmailsSubscriptions from "./UserEmailsSubscriptions"; import UserProfile from "./UserProfile"; import UserProfilePreview from "./UserProfilePreview"; const routes = [ { path: ‘/user/settings‘, // You could also have named views at tho top component: UserSettings, children: [ { path: ‘emails‘, name: ‘emails‘, redirect: {name: ‘profile‘}, // redirect: function (to) { // console.log(to); // return {name: ‘profile‘}; // }, component: UserEmailsSubscriptions }, { path: ‘profile‘, name: ‘profile‘, //此路由對應包含了兩個Vue視圖組件 components: { default: UserProfile, helper: UserProfilePreview } }] } ]; const router = new VueRouter({ mode: ‘history‘, routes, }); export default router;
以上是关于Vue 重定向和别名的主要内容,如果未能解决你的问题,请参考以下文章