Skip to content

Conversation

@daohoangson
Copy link
Contributor

This PR attempts to fix a bug on pages that have HTML base tag.

Reproduce

Edit ./examples/hash-mode/index.html and insert something like this:

  <!DOCTYPE html>
+ <base href="/" />
  <link rel="stylesheet" href="/global.css">
  <a href="/">&larr; Examples index</a>
  <div id="app"></div>
  <script src="/__build__/shared.js"></script>
  <script src="/__build__/hash-mode.js"></script>

node examples/server.js then open http://localhost:8080/hash-mode/.

Expect

window.location got replaced into http://localhost:8080/hash-mode/#/.

Actual

Browser is redirected to http://localhost:8080/#/ instead.

This PR should fix it. Regarding tests, I'm not sure whether we should change the existing hash-mode test specs or create a new one.

@sabakugaara
Copy link
Contributor

sabakugaara commented May 22, 2017

Maybe this is right, I have a issue here: #1426

In your case, <base href="/" /> should be changed to <base href="http://localhost:8080/hash-mode/" /> and then, every thing just work fine

@daohoangson
Copy link
Contributor Author

@sabakugaara for our use case the Vuejs component is init'd as part of a larger page and the base URL cannot be changed.

@285858315
Copy link

需要这个合并吧

@yyx990803 yyx990803 merged commit a52287e into vuejs:dev Jun 16, 2017
@daohoangson daohoangson deleted the fix-replaceHash-html-tag-base branch June 16, 2017 07:14
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

Successfully merging this pull request may close these issues.

4 participants