CRMEB多门店的门店后台首页路由

如何在输入 http://localhost:8080/、http://localhost:8080/store/、http://localhost:8080/custom-store/ 这三个中任意一个链接都能正确跳转到 http://localhost:8080/store/home/index 。要实这个要求,有两种方式:

重定向

const router = new VueRouter({
    routes: [
        {
            path: '/store/home/index',
            name: 'index'
        },
        {
            path: '/',
            redirect: {
                name: 'index'
            }
        },
        {
            path: '/store',
            redirect: {
                name: 'index'
            }
        },
        {
            path: '/custom-store',
            redirect: {
                name: 'index'
            }
        },
    ]
})

以下截图是重定向在项目中实际应用:
在这里插入图片描述

别名

const router = new VueRouter({
    routes: [
        {
            path: '/store/home/index',
            name: 'index',
            alias: ['/', '/store', '/custom-store']
        }
    ]
})

在这里插入图片描述

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-06-18 05:18:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-18 05:18:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-18 05:18:01       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-18 05:18:01       20 阅读

热门阅读

  1. Leetcode 45. 跳跃游戏 II(DP 双指针)

    2024-06-18 05:18:01       9 阅读
  2. 第九章 Three.js 高级材质与着色器 (一)

    2024-06-18 05:18:01       7 阅读
  3. 浔川画板v5.0——浔川python科技社

    2024-06-18 05:18:01       8 阅读
  4. C# —— for循环语句

    2024-06-18 05:18:01       6 阅读
  5. 鸿蒙开发:【启动本地PageAbility】

    2024-06-18 05:18:01       7 阅读
  6. 地学类期刊最新CiteScore™ 汇总

    2024-06-18 05:18:01       8 阅读
  7. 怎么通过AI构架一个个人简介并且写出来

    2024-06-18 05:18:01       9 阅读
  8. C++240617

    C++240617

    2024-06-18 05:18:01      8 阅读