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

  • 相关阅读:
    委托
    apply()和call()
    Sql小技巧
    plsql中文乱码
    Windows8中使用IE8等低版本浏览器
    React Native
    谷歌浏览器添加flash白名单
    jsonp原理详解
    垂直居中
    window.moveTo(),window.moveBy()不生效
  • 原文地址:https://www.cnblogs.com/dzkjz/p/12744424.html
Copyright © 2011-2022 走看看