Vue.js: vue-router subdomains

后端 未结 2 1030
夕颜
夕颜 2021-01-14 14:43

The vue-router documentation does not address this topic.

Perhaps my expectation that vue-router could handle this illustrates a fundamental misunderstandin

2条回答
  •  遥遥无期
    2021-01-14 15:12

    Nope, it's not possible.

    vue-router uses history.pushState, which doesn't allow you to change the origin. Quote from the docs:

    The new URL must be of the same origin as the current URL; otherwise, pushState() will throw an exception.

    In other words - vue-router is a client-side router and you can't change the subdomain on the client-side (in the browser) without reloading the page.

提交回复
热议问题