zoukankan      html  css  js  c++  java
  • 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.test Redirect


    vue.test RedirectFunction

  • 相关阅读:
    html表单
    html基础
    MySQL数据库 数据的更新
    JAVA数据库编程
    集合框架
    线程和进程
    反射
    centos 7环境
    js中的this
    javascript的作用域以及闭包现象
  • 原文地址:https://www.cnblogs.com/dzkjz/p/12744424.html
Copyright © 2011-2022 走看看