{"id":30394,"date":"2024-11-25T13:05:07","date_gmt":"2024-11-25T05:05:07","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30394\/"},"modified":"2024-11-25T13:05:07","modified_gmt":"2024-11-25T05:05:07","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e8%b7%af%e7%94%b1%e8%b7%b3%e8%bd%ac%e7%9a%84%e4%b8%89%e7%a7%8d%e5%bd%a2%e5%bc%8f%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30394\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u8def\u7531\u8df3\u8f6c\u7684\u4e09\u79cd\u5f62\u5f0f\u8be6\u89e3"},"content":{"rendered":"<p>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u8df3\u8f6c\uff0c\u5171\u6709\u4e09\u79cd\u5f62\u5f0f\uff0c\u9875\u9762\u4e2d\u4f7f\u7528navigator\u7ec4\u4ef6\u505a\u9875\u9762\u94fe\u63a5\u5f62\u5f0f\u8def\u7531\u8df3\u8f6c\uff0cjs\u4e2d\u53ef\u4ee5\u4f7f\u7528wx.navigateto&#8211;\u4fdd\u7559\u5f53\u524d\u9875\u9762\uff0c\u8df3\u8f6c\u5230\u5e94\u7528\u5185\u7684\u67d0\u4e2a\u9875\u9762\uff0cwx.redirectto&#8211;\u5173\u95ed\u5f53\u524d\u9875\u9762\uff0c\u8df3\u8f6c\u5230\u5e94\u7528\u5185\u7684\u67d0\u4e2a\u9875\u9762&nbsp;wx.navigateback()&#8211;\u5173\u95ed\u5f53\u524d\u9875\u9762\uff0c\u56de\u9000\u524d\u4e00\u9875\u9762\u3002<\/p>\n<p style=\"margin-top: 24px;margin-bottom: 12px;font-weight: 400;position: relative;line-height: 1em;font-size: 20px;font-family:\">navigator\u7ec4\u4ef6\u505a\u9875\u9762\u94fe\u63a5<\/p>\n<table border=\"1px\">\n<thead>\n<tr>\n<th>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u5c5e\u6027\u540d<\/th>\n<th>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u7c7b\u578b<\/th>\n<th>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u9ed8\u8ba4\u503c<\/th>\n<th>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u5e94\u7528\u5185\u7684\u8df3\u8f6c\u94fe\u63a5<\/td>\n<\/tr>\n<tr>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; redirect<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Boolean<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; false<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u662f\u5426\u5173\u95ed\u5f53\u524d\u9875\u9762<\/td>\n<\/tr>\n<tr>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hover-class<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navigator-hover<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u6307\u5b9a\u70b9\u51fb\u65f6\u7684\u6837\u5f0f\u7c7b\uff0c\u5f53hover-class=&#8221;none&#8221;\u65f6\uff0c\u6ca1\u6709\u70b9\u51fb\u6001\u6548\u679c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6ce8\uff1anavigator-hover\u9ed8\u8ba4\u4e3a{background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;},&nbsp; \u7684\u5b50\u8282\u70b9\u80cc\u666f\u8272\u5e94\u4e3a\u900f\u660e\u8272<\/p>\n<p>\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre>\/**&nbsp;wxss&nbsp;**\/\r\n\/**&nbsp;\u4fee\u6539\u9ed8\u8ba4\u7684navigator\u70b9\u51fb\u6001&nbsp;**\/\r\n.navigator-hover&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;color:blue;\r\n}\r\n\/**&nbsp;\u81ea\u5b9a\u4e49\u5176\u4ed6\u70b9\u51fb\u6001\u6837\u5f0f\u7c7b&nbsp;**\/\r\n.other-navigator-hover&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;color:red;\r\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>&lt;!-- sample.wxml --&gt;\r\n&lt;view&gt;\r\n&nbsp;&nbsp;&lt;navigator&gt;\u8df3\u8f6c\u5230\u65b0\u9875\u9762&lt;\/navigator&gt;\r\n&nbsp;&nbsp;&lt;navigator&gt;\u5728\u5f53\u524d\u9875\u6253\u5f00(\u5173\u95ed\u4e86\u5f53\u524d\u9875\u9762)&lt;\/navigator&gt;&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>&lt;!-- navigator.wxml --&gt;\r\n&lt;view&gt;&nbsp;{{title}}&nbsp;&lt;\/view&gt;&lt;view&gt;&nbsp;\u70b9\u51fb\u5de6\u4e0a\u89d2\u8fd4\u56de\u56de\u5230\u4e4b\u524d\u9875\u9762&nbsp;&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>&lt;!-- redirect.wxml --&gt;\r\n&lt;view&gt;&nbsp;{{title}}&nbsp;&lt;\/view&gt;&lt;view&gt;&nbsp;\u70b9\u51fb\u5de6\u4e0a\u89d2\u8fd4\u56de\u56de\u5230\u4e0a\u7ea7\u9875\u9762&nbsp;&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>\/\/&nbsp;redirect.js&nbsp;navigator.js\r\nPage({\r\n&nbsp;&nbsp;onLoad:&nbsp;function(options)&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;this.setData({\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;title:&nbsp;options.title\r\n&nbsp;&nbsp;&nbsp;&nbsp;})\r\n&nbsp;&nbsp;}\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 24px;margin-bottom: 12px;font-weight: 400;position: relative;line-height: 1em;font-size: 20px;font-family:\">wx.navigateTo(OBJECT)<\/p>\n<p>\u4fdd\u7559\u5f53\u524d\u9875\u9762\uff0c\u8df3\u8f6c\u5230\u5e94\u7528\u5185\u7684\u67d0\u4e2a\u9875\u9762\uff0c\u4f7f\u7528wx.navigateBack\u53ef\u4ee5\u8fd4\u56de\u5230\u539f\u9875\u9762\u3002<\/p>\n<p>OBJECT\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<table border=\"1px\">\n<thead>\n<tr>\n<th>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u53c2\u6570<\/th>\n<th>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u7c7b\u578b<\/th>\n<th>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u5fc5\u586b<\/th>\n<th>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u662f<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u9700\u8981\u8df3\u8f6c\u7684\u5e94\u7528\u5185\u9875\u9762\u7684\u8def\u5f84<\/td>\n<\/tr>\n<tr>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Function<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u5426<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u63a5\u53e3\u8c03\u7528\u6210\u529f\u7684\u56de\u8c03\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fail<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Function<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u5426<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u63a5\u53e3\u8c03\u7528\u5931\u8d25\u7684\u56de\u8c03\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; complete<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Function<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u5426<\/td>\n<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u63a5\u53e3\u8c03\u7528\u7ed3\u675f\u7684\u56de\u8c03\u51fd\u6570\uff08\u8c03\u7528\u6210\u529f\u3001\u5931\u8d25\u90fd\u4f1a\u6267\u884c\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre>wx.navigateTo({\r\n&nbsp;&nbsp;url:&nbsp;'test?id=1'\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6ce8\u610f\uff1a\u4e3a\u4e86\u4e0d\u8ba9\u7528\u6237\u5728\u4f7f\u7528\u5c0f\u7a0b\u5e8f\u65f6\u9020\u6210\u56f0\u6270\uff0c\u6211\u4eec\u89c4\u5b9a\u9875\u9762\u8def\u5f84\u53ea\u80fd\u662f\u4e94\u5c42\uff0c\u8bf7\u5c3d\u91cf\u907f\u514d\u591a\u5c42\u7ea7\u7684\u4ea4\u4e92\u65b9\u5f0f\u3002<\/p>\n<p style=\"margin-top: 24px;margin-bottom: 12px;font-weight: 400;position: relative;line-height: 1em;font-size: 20px;font-family:\">wx.redirectTo(OBJECT)<\/p>\n<p>\u5173\u95ed\u5f53\u524d\u9875\u9762\uff0c\u8df3\u8f6c\u5230\u5e94\u7528\u5185\u7684\u67d0\u4e2a\u9875\u9762\u3002<\/p>\n<p>OBJECT\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<\/p>\n<table border=\"1px\">\n<thead>\n<tr>\n<th> \u53c2\u6570<\/th>\n<th> \u7c7b\u578b<\/th>\n<th> \u5fc5\u586b<\/th>\n<th> \u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td> url<\/td>\n<td> String<\/td>\n<td> \u662f<\/td>\n<td> \u9700\u8981\u8df3\u8f6c\u7684\u5e94\u7528\u5185\u9875\u9762\u7684\u8def\u5f84<\/td>\n<\/tr>\n<tr>\n<td> success<\/td>\n<td> Function<\/td>\n<td> \u5426<\/td>\n<td> \u63a5\u53e3\u8c03\u7528\u6210\u529f\u7684\u56de\u8c03\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td> fail<\/td>\n<td> Function<\/td>\n<td> \u5426<\/td>\n<td> \u63a5\u53e3\u8c03\u7528\u5931\u8d25\u7684\u56de\u8c03\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td> complete<\/td>\n<td> Function<\/td>\n<td> \u5426<\/td>\n<td> \u63a5\u53e3\u8c03\u7528\u7ed3\u675f\u7684\u56de\u8c03\u51fd\u6570\uff08\u8c03\u7528\u6210\u529f\u3001\u5931\u8d25\u90fd\u4f1a\u6267\u884c\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<pre>wx.redirectTo({\r\n&nbsp;&nbsp;url:&nbsp;'test?id=1'\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top: 24px;margin-bottom: 12px;font-weight: 400;position: relative;line-height: 1em;font-size: 20px;font-family:\">wx.navigateBack()<\/p>\n<p>\u5173\u95ed\u5f53\u524d\u9875\u9762\uff0c\u56de\u9000\u524d\u4e00\u9875\u9762\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u8def\u7531\u8df3\u8f6c\u7684\u4e09\u79cd\u5f62\u5f0f\u8be6\u89e3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u8df3\u8f6c\uff0c\u5171\u6709\u4e09\u79cd\u5f62\u5f0f\uff0c\u9875\u9762\u4e2d\u4f7f\u7528navigator\u7ec4\u4ef6\u505a\u9875\u9762\u94fe\u63a5\u5f62\u5f0f\u8def\u7531\u8df3\u8f6c\uff0cjs\u4e2d\u53ef\u4ee5\u4f7f\u7528wx.navigateto&#8211;\u4fdd\u7559\u5f53\u524d\u9875\u9762\uff0c\u8df3\u8f6c\u5230\u5e94\u7528\u5185\u7684\u67d0\u4e2a\u9875\u9762\uff0cwx.redirectto&#8211;\u5173\u95ed\u5f53\u524d\u9875\u9762\uff0c\u8df3\u8f6c\u5230\u5e94\u7528\u5185\u7684\u67d0\u4e2a\u9875\u9762&nbsp;wx.navigateback()&#8211;\u5173\u95ed\u5f53\u524d\u9875\u9762\uff0c\u56de\u9000\u524d\u4e00\u9875\u9762\u3002 navigator\u7ec4\u4ef6\u505a\u9875\u9762\u94fe\u63a5 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u5c5e\u6027\u540d &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u7c7b\u578b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u9ed8\u8ba4\u503c &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u8bf4\u660e &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-30394","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=30394"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30394\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}