vue-router\u83b7\u53d6url\u4f20\u9012\u7684\u53c2\u6570\u5206\u4e3a\u4e24\u79cd\u60c5\u51b5\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\u83b7\u53d6url\u53c2\u6570\u6709\u4e24\u79cd\u60c5\u51b5\uff1a<\/p>\n
\u5e94\u7528\u573a\u666f\u4e00\uff1a\u5185\u90e8\u9875\u9762\u4e4b\u95f4\u4e92\u76f8\u4f20\u503c
\n\u5047\u5982\u8981\u4eceA\u9875\u9762\u8df3\u8f6c\u5230B\u9875\u9762\uff0c<\/p>\n
\r\nthis.$router.push({path:"\/B",query:{\r\n Id : this.tId ,\r\n ...\r\n}})\r\n<\/pre>\n\u8fdb\u5165B\u9875\u9762\u4e4b\u540e\uff0c<\/p>\n
\r\nthis.Id = this.$route.query.Id;\r\n<\/pre>\n\u5c31\u80fd\u5c06A\u9875\u9762\u7684id\u4f20\u5165B\u9875\u9762\uff0c\u8fdb\u884c\u53c2\u6570\u83b7\u53d6\u3002<\/p>\n
\u5e94\u7528\u573a\u666f\u4e8c\uff1a\u5916\u7cfb\u7edf\u8df3\u8f6cVue\u9879\u76ee\u65f6\u81ea\u5e26\u53c2\u6570
\n\u4f8b\u5982: https:\/\/shq5785.blog.csdn.net\/list?Id=sunhuaqiang1#\/<\/code><\/p>\n\u5916\u7cfb\u7edf\u8df3\u8f6c\u8fdb\u5165\u7684url\u4f1a\u5728Vue\u9879\u76ee\u7f16\u8bd1\u540e\u81ea\u52a8\u6dfb\u52a0 \u201c#\/\u201d\u540e\u7f00 \uff0c\u5176\u4e2d\u5e26\u7684\u53c2\u6570\u5728 \u201c#\/\u201d\u4e4b\u524d\uff0c\u6240\u4ee5\u5e94\u7528\u573a\u666f\u4e00\u4e2d\u7684\u65b9\u6cd5\u65e0\u6cd5\u83b7\u53d6\uff0c\u53ea\u80fd\u5e94\u7528JS\u7684\u65b9\u6cd5\u6765\u83b7\u53d6\uff0c\u89e3\u6790\u529f\u80fd\u51fd\u6570\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n
\r\ngetURLParams(url) {\r\n let param = url.split('#')[0]; \/\/\u83b7\u53d6#\/\u4e4b\u524d\u7684\u5b57\u7b26\u4e32\r\n var paramContent = param.split('?')[1]; \/\/\u83b7\u53d6?\u4e4b\u540e\u7684\u53c2\u6570\u5b57\u7b26\u4e32\r\n var paramsArray = paramContent.split('&'); \/\/\u53c2\u6570\u5b57\u7b26\u4e32\u5206\u5272\u4e3a\u6570\u7ec4\r\n var paramResult = {};\r\n \/\/\u904d\u5386\u6570\u7ec4\uff0c\u62ff\u5230json\u5bf9\u8c61\r\n paramsArray.forEach((item, index, paramsArray) => {\r\n\t\tparamResult[paramsArray[index].split('=')[0]] = paramsArray[index].split('=')[1];\r\n })\r\n return paramResult;\r\n}\r\n<\/pre>\n\u8c03\u7528\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n
this.getURLParams(window.location.href)<\/pre>\n","protected":false},"excerpt":{"rendered":"\u83b7\u53d6url\u53c2\u6570\u6709\u4e24\u79cd\u60c5\u51b5\uff1a \u5e94\u7528\u573a\u666f\u4e00\uff1a\u5185\u90e8\u9875\u9762\u4e4b\u95f4\u4e92\u76f8\u4f20\u503c \u5047\u5982\u8981\u4eceA\u9875\u9762\u8df3\u8f6c\u5230B\u9875\u9762\uff0c this.$rou […]<\/p>\n","protected":false},"author":1903,"featured_media":229087,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-229082","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/229082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1903"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=229082"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/229082\/revisions"}],"predecessor-version":[{"id":229100,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/229082\/revisions\/229100"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/229087"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=229082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=229082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=229082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}