14
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vue-router で絶対パス ( http 始まり ) を取得する

Last updated at Posted at 2018-11-24

router.resolve が用意されているので、それを使うだけ。

this.$router.resolve({
  name: 'ExmaplePage',
  params: {
    id: id
  }
}).href

これだけだと /example_page/1 のようになるので location.origin と組わせる。

const url = this.$router.resolve({
  name: 'ExmaplePage',
  params: {
    id: id
  }
}).href
location.origin + url.location

これで https://example.com/example_page/1 のようにできる。

14
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?