{"id":185624,"date":"2023-09-19T13:41:33","date_gmt":"2023-09-19T05:41:33","guid":{"rendered":"http:\/\/www.idc.net\/help\/185624\/"},"modified":"2023-09-19T13:41:33","modified_gmt":"2023-09-19T05:41:33","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%95%99%e7%a8%8b%ef%bc%9a%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8fapi-%e8%ae%be%e5%a4%87-%e7%bd%97%e7%9b%98","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/185624\/","title":{"rendered":"\u540e\u6d6a\u4e91\u5c0f\u7a0b\u5e8f\u6559\u7a0b\uff1a\u5fae\u4fe1\u5c0f\u7a0b\u5e8fAPI-\u8bbe\u5907-\u7f57\u76d8"},"content":{"rendered":"<h2>wx.onCompassChange(CALLBACK) <\/p>\n<hr>\n<\/h2>\n<p>\u76d1\u542c\u7f57\u76d8\u6570\u636e\uff0c<span>\u9891\u7387\uff1a5\u6b21\/\u79d2\uff0c\u63a5\u53e3\u8c03\u7528\u540e\u4f1a\u81ea\u52a8\u5f00\u59cb\u76d1\u542c\uff0c\u53ef\u4f7f\u7528<\/span><code>wx.stopCompass<\/code><span>\u505c\u6b62\u76d1\u542c\u3002<\/span>  <\/p>\n<p><strong>CALLBACK\u8fd4\u56de\u53c2\u6570\uff1a<\/strong> <\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>direction<\/td>\n<td>Number<\/td>\n<td>\u9762\u5bf9\u7684\u65b9\u5411\u5ea6\u6570<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u793a\u4f8b\u4ee3\u7801\uff1a<\/strong> <\/p>\n<pre><code>wx.onCompassChange(function (res) {\n  console.log(res.direction)\n})<\/code>\n<\/pre>\n<h2>wx.startCompass(OBJECT) <\/p>\n<hr>\n<\/h2>\n<blockquote>\n<p>\u57fa\u7840\u5e93 1.1.0 \u5f00\u59cb\u652f\u6301\uff0c\u4f4e\u7248\u672c\u9700\u505a\u517c\u5bb9\u5904\u7406 <\/p>\n<\/blockquote>\n<p>\u5f00\u59cb\u76d1\u542c\u7f57\u76d8\u6570\u636e\u3002<\/p>\n<p><strong>OBJECT\u53c2\u6570\u8bf4\u660e\uff1a<\/strong> <\/p>\n<table>\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>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><strong>\u793a\u4f8b\u4ee3\u7801\uff1a<\/strong> <\/p>\n<pre><code>wx.startCompass()<\/code><\/pre>\n<h2>wx.stopCompass(OBJECT) <\/p>\n<hr>\n<\/h2>\n<blockquote>\n<p>\u57fa\u7840\u5e93 1.1.0 \u5f00\u59cb\u652f\u6301\uff0c\u4f4e\u7248\u672c\u9700\u505a\u517c\u5bb9\u5904\u7406 <\/p>\n<\/blockquote>\n<p>\u505c\u6b62\u76d1\u542c\u7f57\u76d8\u6570\u636e\u3002<\/p>\n<p><strong>OBJECT\u53c2\u6570\u8bf4\u660e\uff1a<\/strong> <\/p>\n<table>\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>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><strong>\u793a\u4f8b\u4ee3\u7801\uff1a<\/strong> <\/p>\n<pre><code>wx.stopCompass()<\/code><\/pre>\n<h2>wx.offCompassChange(function callback)<\/h2>\n<hr>\n<blockquote><p>\n  \u57fa\u7840\u5e93 2.9.3 \u5f00\u59cb\u652f\u6301\uff0c\u4f4e\u7248\u672c\u9700\u505a \u517c\u5bb9\u5904\u7406\n<\/p><\/blockquote>\n<p>\u53d6\u6d88\u76d1\u542c\u7f57\u76d8\u6570\u636e\u53d8\u5316\u4e8b\u4ef6\uff0c\u53c2\u6570\u4e3a\u7a7a\uff0c\u5219\u53d6\u6d88\u6240\u6709\u7684\u4e8b\u4ef6\u76d1\u542c\u3002<\/p>\n<h2>\u53c2\u6570<\/h2>\n<h3>function callback<\/h3>\n<p>\u7f57\u76d8\u6570\u636e\u53d8\u5316\u4e8b\u4ef6\u7684\u56de\u8c03\u51fd\u6570<\/p>\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>wx.onCompassChange(CALLBACK) \u76d1\u542c\u7f57\u76d8\u6570\u636e\uff0c\u9891\u7387\uff1a5\u6b21\/\u79d2\uff0c\u63a5\u53e3\u8c03\u7528\u540e\u4f1a\u81ea\u52a8\u5f00\u59cb\u76d1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182398],"tags":[],"class_list":["post-185624","post","type-post","status-publish","format-standard","hentry","category-mini-program"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/185624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=185624"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/185624\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=185624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=185624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=185624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}