{"id":1005,"date":"2023-03-12T08:58:18","date_gmt":"2023-03-12T00:58:18","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1005"},"modified":"2023-04-29T13:18:26","modified_gmt":"2023-04-29T05:18:26","slug":"vue-js-routing-router-link-parameter-transmission-and-parameter-acquisition","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/12\/vue-js-routing-router-link-parameter-transmission-and-parameter-acquisition\/","title":{"rendered":"Vue.js\u8def\u7531router-link\u4f20\u53c2\u4ee5\u53ca\u53c2\u6570\u83b7\u53d6"},"content":{"rendered":"<h2>query<\/h2>\n<p>\u8def\u5f84\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:8081\/#\/test?name=1\">http:\/\/localhost:8081\/#\/test?name=1<\/a><\/p>\n<pre><code class=\"language-html\">&lt;router-link :to=&quot;{path:&#039;\/test&#039;, query: {name: id}}&quot;&gt;\u8df3\u8f6c&lt;\/router-link&gt;<\/code><\/pre>\n<p>\u83b7\u53d6(id\u662f\u53c2\u6570)\uff1athis.$route.query.id<\/p>\n<p><!-- more --><\/p>\n<h2>params<\/h2>\n<p>\u8def\u5f84\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:8081\/#\/test\/1\">http:\/\/localhost:8081\/#\/test\/1<\/a><\/p>\n<pre><code class=\"language-html\">&lt;router-link :to=&quot;&#039;\/test\/&#039;+id&quot;&gt;\u8df3\u8f6c&lt;\/router-link&gt;<\/code><\/pre>\n<p>\u83b7\u53d6(id\u662f\u53c2\u6570)\uff1athis.$route.params.id<\/p>\n<p>this.$route\u662f\u4e00\u4e2a\u6570\u7ec4\uff0c\u91cc\u9762\u5305\u542b\u8def\u7531\u7684\u6240\u6709\u4fe1\u606f<\/p>\n<p>\u5bf9\u5e94\u7684RESTful\u8def\u7531\u914d\u7f6e\uff1a<\/p>\n<pre><code class=\"language-javascript\">{\n  path: &#039;\/test\/:id&#039;,\n  name: &#039;test&#039;,\n  meta: {\n    title: &#039;\u6d4b\u8bd5&#039;,\n  },\n  component: resolve =&gt; require([&#039;..\/components\/test.vue&#039;], resolve)\n}<\/code><\/pre>\n<p>\u6ce8\u610f\uff1arouter-link\u4e2d\u94fe\u63a5\u5982\u679c\u662f\u2018\/\u2019\u5f00\u59cb\u5c31\u662f\u4ece\u6839\u8def\u7531\u5f00\u59cb\uff0c\u5982\u679c\u5f00\u59cb\u4e0d\u5e26\u2018\/\u2019\uff0c\u5219\u4ece\u5f53\u524d\u8def\u7531\u5f00\u59cb<\/p>\n","protected":false},"excerpt":{"rendered":"<p>query \u8def\u5f84\uff1ahttp:\/\/localhost:8081\/#\/test?name=1 &lt;router [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-1005","post","type-post","status-publish","format-standard","hentry","category-vue"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1005"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1005\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}