{"id":11133,"date":"2020-06-14T09:55:54","date_gmt":"2020-06-14T00:55:54","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=11133"},"modified":"2023-05-27T23:56:59","modified_gmt":"2023-05-27T14:56:59","slug":"%e3%80%90vue-js%e3%80%91%e3%80%8crouter-link%e3%80%8d%e3%81%ae%e8%a9%b3%e7%b4%b0%e4%bb%95%e6%a7%98","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=11133","title":{"rendered":"\u3010Vue.js\u3011\u300crouter-link\u300d\u306e\u8a73\u7d30\u4ed5\u69d8"},"content":{"rendered":"<h2>router-link\u306e\u5b9f\u88c5<\/h2>\n<table>\n<tbody>\n<tr>\n<th width=\"120\">\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>&lt;router-view&gt;<\/td>\n<td>\u300c&lt;router-link&gt;\u300d\u3067\u30de\u30c3\u30c1\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u63cf\u753b\u3059\u308b\u3002\u63cf\u753b\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306froutes\u306b\u3066\u767b\u9332\u3057\u305f\u3082\u306e\u3092URL\u3092\u898b\u3066\u6c7a\u3081\u307e\u3059\u3002\uff08<span style=\"color: #ff0000;\"><strong>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5207\u308a\u66ff\u3048\u308b\u52d5\u7684\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/strong><\/span>\u306e\u3088\u3046\u306a\u52d5\u304d\u3092\u3057\u307e\u3059\u3002\uff09<\/td>\n<\/tr>\n<tr>\n<td>&lt;router-link&gt;<\/td>\n<td>\u30eb\u30fc\u30c8\u306e\u30ea\u30f3\u30af\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u30de\u30c3\u30c1\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3001\u300c&lt;router-view&gt;\u300d\u306b\u57cb\u3081\u8fbc\u307f\u307e\u3059\u3002<span style=\"color: #ff0000;\"><strong>\u666e\u901a\u306ba\u30bf\u30b0\u3092\u4f7f\u3063\u3066\u3082\u540c\u3058\u3088\u3046\u306b\u30da\u30fc\u30b8\u3092\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u306f\u53ef\u80fd\u306a\u306e\u3067\u3059\u304c\u3001a\u30bf\u30b0\u3067\u306f\u6bce\u56de\u30b5\u30fc\u30d0\u30fc\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/strong><\/span>router-link\u3092\u4f7f\u3046\u3053\u3068\u3067\u30b5\u30fc\u30d0\u30fc\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u308f\u305aVue.js\u5074\u3067\u30da\u30fc\u30b8\u3092\u5207\u308a\u66ff\u3048\u308b\u51e6\u7406\u3092\u884c\u3044<span style=\"color: #ff0000;\"><strong>SPA\u3092\u5b9f\u73fe\u3059\u308b\u4e8b\u304c\u53ef\u80fd<\/strong><\/span>\u3067\u3059\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u5b9f\u88c5\u4f8b<\/h3>\n<p>URL1\u3068\u3044\u3046\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089Vue Router\u306b\u767b\u9332\u3057\u305fURL\u306e\u5185\u5bb9\u304c\u300crouter-view\u300d\u306b\u63cf\u753b\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">  &lt;div id=\"app\"&gt;\r\n    &lt;router-link to=\"\/url1\"&gt;URL1&lt;\/router-link&gt;\r\n    &lt;router-link to=\"\/url2\"&gt;URL2&lt;\/router-link&gt;\r\n    &lt;router-view&gt;&lt;\/router-view&gt;\r\n  &lt;\/div&gt;<\/pre>\n<h2>router-link\u306e\u5c5e\u6027<\/h2>\n<table>\n<tbody>\n<tr>\n<th width=\"120\">\u5c5e\u6027\u540d<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>to<\/td>\n<td>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u5148\u306e\u30da\u30fc\u30b8\uff08\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>active-class<\/td>\n<td><span style=\"color: #ff0000;\"><strong>\u30a2\u30af\u30bb\u30b9\u3057\u305fURL\u306bto\u3067\u6307\u5b9a\u3057\u305f\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u542b\u3093\u3067\u3044\u308b\u5834\u5408\u306bCSS\u30af\u30e9\u30b9\u3092\u9069\u7528<\/strong><\/span>\u3057\u307e\u3059\u3002\uff08\u4f8b\u3048\u3070\u3001to\u306b\u300c\/\u300d\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306f\u300c\/\u300d\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3082\u300c\/content\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3082\u305d\u306e\u30af\u30e9\u30b9\u304c\u9069\u7528\u3055\u308c\u307e\u3059\u3002\uff09<\/td>\n<\/tr>\n<tr>\n<td>exact<\/td>\n<td>active-class\u5358\u4f53\u3067\u4f7f\u7528\u3057\u305f\u5834\u5408\u306fto\u3067\u6307\u5b9a\u3057\u305fURL\u3092\u542b\u3093\u3067\u3044\u308b\u5834\u5408\u3067\u3057\u305f\u304c\u3001exact\u3092\u6307\u5b9a\u3059\u308b\u4e8b\u3067<span style=\"color: #ff0000;\"><strong>to\u306b\u4e00\u81f4\u3059\u308b\u5834\u5408\u306bactive-class\u3092\u9069\u7528\u3059\u308b<\/strong><\/span>\u3068\u3044\u3046\u3088\u3046\u306b\u3067\u304d\u307e\u3059\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>to\u5c5e\u6027\u3092\u52d5\u7684\u306b\u8a18\u8ff0\u3059\u308b\u3002<\/h3>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u4e8b\u3067URL\u3092\u52d5\u7684\u306b\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u3055\u305b\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002\u5185\u90e8\u7684\u306b\u306f\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u306e<span style=\"color: #ff0000;\"><strong>v-bind\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/strong><\/span><\/p>\n<pre class=\"lang:default decode:true \">    &lt;router-link \r\n      :to=\"'\/content\/' +(Number(id) + 1)\"\r\n      &gt;\u30ea\u30f3\u30af\u540d&lt;\/router-link&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"router-link\u306e\u5b9f\u88c5 \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 \u8aac\u660e &lt;router-view&gt; \u300c&lt;router-link&gt;\u300d\u3067\u30de\u30c3\u30c1\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u63cf\u753b\u3059\u308b\u3002\u63cf\u753b\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306froutes\u306b\u3066\u767b\u9332\u3057\u305f [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[60],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/11133"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11133"}],"version-history":[{"count":10,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/11133\/revisions"}],"predecessor-version":[{"id":20618,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/11133\/revisions\/20618"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11133"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}