Skip to content

多页应用路由使用history模式工作不正常(multi-page app does't working well when the router use history mode) #3712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brandon3343 opened this issue Mar 26, 2019 · 2 comments

Comments

@brandon3343
Copy link

Version

3.5.1

Reproduction link

https://github.com/l619534951/vue-mobile-game-test

Environment info

  System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
  Binaries:
    Node: 10.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.17763.1.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0-beta.3
    @vue/babel-plugin-transform-vue-jsx:  1.0.0-beta.3
    @vue/babel-preset-app:  3.5.1
    @vue/babel-preset-jsx:  1.0.0-beta.3
    @vue/babel-sugar-functional-vue:  1.0.0-beta.3
    @vue/babel-sugar-inject-h:  1.0.0-beta.3
    @vue/babel-sugar-v-model:  1.0.0-beta.3
    @vue/babel-sugar-v-on:  1.0.0-beta.3
    @vue/cli-overlay:  3.5.1
    @vue/cli-plugin-babel: ^3.5.0 => 3.5.1
    @vue/cli-plugin-eslint: ^3.5.1 => 3.5.1
    @vue/cli-service: ^3.5.0 => 3.5.1
    @vue/cli-shared-utils:  3.5.1
    @vue/component-compiler-utils:  2.6.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.2
    vue: ^2.6.6 => 2.6.10
    vue-cli-plugin-iview: ^1.0.6 => 1.0.6
    vue-eslint-parser:  2.0.3
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.0
    vue-router: ^3.0.1 => 3.0.2
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.21 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.0.1 => 3.1.0
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

1、git clone https://github.com/l619534951/vue-mobile-game-test

2、cd vue-mobile-game-test

3、npm install

4、npm run serve

What is expected?

打开链接http://127.0.0.1:8080/console 正确匹配到对应的路由

(open this link:http://127.0.0.1:8080/console, it's should match the correct route)

打开链接http://127.0.0.1:8080/console/fdfdfd 匹配到404路由

(open this link:http://127.0.0.1:8080/console/fdfdfd, it's should match the 404 route)

What is actually happening?

两个链接都匹配到404的路由了(hash模式正常)
(both of links i gave match 404 route, but it's working well when i change the router mode to 'hash')


用一句话总结就是,hash模式工作正常,history模式工作不正常

@LinusBorg
Copy link
Member

You have to set the router's base to the page's path.

So base: '/console'

@reuwi
Copy link

reuwi commented Jul 17, 2019

It will be much better if we don't need to config it manually😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants