admin管理员组

文章数量:1633802

由于业务需要,需要使用到多页面,最近在多页面中路由跳转遇到了一个问题:
1、有index.html、exchange.html两个模板文件,分别对应两个入口,vue.config.js配置如下

// 配置多页面入口
  pages: {
    index: {
      entry: 'src/main.js',
      template: 'public/index.html',
      filename: 'index.html',
      title: 'Index Page',
      chunks: ['chunk-vendors', 'chunk-common', 'index']
    },
    exchange: {
      entry: 'src/exchange_main.js',
      title: 'exchange page',
      template: 'public/exchange.html',
      filename: 'exchange.html',
    }
  },

2、index入口对应的路由访问地址为:http://localhost:8088/#/xxx
exchange入口对应的路由访问地址为:http://localhost:8088/exchange.html#/xxx
3、问题来了,当我在http://localhost:8088/exchange.html#/xxx页面中需要回到http://localhost:8088/#/xxx页面时,使用<router-link>组件来访问就变成这样了:

http://localhost:8088/exchange.html#/exchange中我想回到首页,于是路由这样写:
<router-link to="/home">首页</router-link>,然后就变成上面这样了,这就导致我不能正确的回到首页。
转自:https://segmentfault/q/1010000017866630

本文标签: 跳转路由多页vue