{"id":33205,"date":"2024-11-25T14:53:29","date_gmt":"2024-11-25T06:53:29","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33205\/"},"modified":"2024-11-25T14:53:29","modified_gmt":"2024-11-25T06:53:29","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e4%ba%ae%e5%ba%a6%e6%80%8e%e4%b9%88%e8%b0%83%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33205\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4eae\u5ea6\u600e\u4e48\u8c03\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/046\/5ed6fe6eefdfb837.jpg\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4eae\u5ea6\u600e\u4e48\u8c03\uff1f\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4eae\u5ea6\u600e\u4e48\u8c03\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4eae\u5ea6\u600e\u4e48\u8c03\uff1f<\/strong><\/p>\n<p>\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u53ef\u4ee5\u901a\u8fc7\u201cwx.setScreenBrightness()\u201d\u65b9\u6cd5\u8fdb\u884c\u4eae\u5ea6\u7684\u8c03\u8282\uff0c\u8be5\u65b9\u6cd5\u7684\u4f5c\u7528\u662f\u5bf9\u5c4f\u5e55\u7684\u4eae\u5ea6\u8fdb\u884c\u8c03\u6574\uff0c\u4f7f\u7528\u65b9\u6cd5\u53ea\u9700\u5411\u8be5\u65b9\u6cd5\u4f20\u5165\u4e00\u4e2a\u5bf9\u8c61\uff0c\u5e76\u4e14\u5c06\u5bf9\u8c61\u7684\u201cvalue\u201d\u5c5e\u6027\u8bbe\u7f6e\u4e3a1\u5373\u53ef\u3002<strong><br \/><\/strong><\/p>\n<p><strong>\u793a\u4f8b\u4ee3\u7801<\/strong><\/p>\n<pre>\/\/\u83b7\u53d6\u5e94\u7528\u5b9e\u4f8b\nvar&nbsp;app&nbsp;=&nbsp;getApp()\nPage({\n&nbsp;&nbsp;data:{\n&nbsp;&nbsp;},\n&nbsp;&nbsp;changeScreenLight:function(e){\n&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;that&nbsp;=&nbsp;this;\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u6ed1\u52a8\u62c9\u6746\u83b7\u5f97\u503c\n&nbsp;&nbsp;&nbsp;&nbsp;wx.setScreenBrightness({\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value:&nbsp;parseFloat(e.detail.value).toFixed(1)\n&nbsp;&nbsp;&nbsp;&nbsp;})\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u7ed9\u5c4f\u5e55\u4eae\u5ea6\u8d4b\u503c\n&nbsp;&nbsp;&nbsp;&nbsp;wx.getScreenBrightness({\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success:&nbsp;function(res)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that.setData({\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ScreenBrightness:&nbsp;res.value\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;})\n&nbsp;&nbsp;}\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u53c2\u6570\u8bf4\u660e<\/strong><\/p>\n<table width=\"808\">\n<thead>\n<tr>\n<th width=\"118\">\u53c2\u6570<\/th>\n<th width=\"113\">\u7c7b\u578b<\/th>\n<th width=\"69\">\u5fc5\u586b<\/th>\n<th width=\"507\">\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td width=\"118\">value<\/td>\n<td width=\"113\">Number<\/td>\n<td width=\"69\">\u662f<\/td>\n<td width=\"507\">\u5c4f\u5e55\u4eae\u5ea6\u503c\uff0c\u8303\u56f4 0~1\uff0c0 \u6700\u6697\uff0c1 \u6700\u4eae<\/td>\n<\/tr>\n<tr>\n<td width=\"118\">success<\/td>\n<td width=\"113\">Function<\/td>\n<td width=\"69\">\u5426<\/td>\n<td width=\"507\">\u63a5\u53e3\u8c03\u7528\u6210\u529f<\/td>\n<\/tr>\n<tr>\n<td width=\"118\">fail<\/td>\n<td width=\"113\">Function<\/td>\n<td width=\"69\">\u5426<\/td>\n<td width=\"507\">\u63a5\u53e3\u8c03\u7528\u5931\u8d25\u7684\u56de\u8c03\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"118\">complete<\/td>\n<td width=\"113\">Function<\/td>\n<td width=\"69\">\u5426<\/td>\n<td width=\"507\">\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>\u63a8\u8350\u6559\u7a0b\uff1a\u300a\u300b<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4eae\u5ea6\u600e\u4e48\u8c03\uff1f\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\u4eae\u5ea6\u600e\u4e48\u8c03\uff1f \u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u53ef\u4ee5\u901a\u8fc7\u201cwx.setScreenBrightness()\u201d\u65b9\u6cd5\u8fdb\u884c\u4eae\u5ea6\u7684\u8c03\u8282\uff0c\u8be5\u65b9\u6cd5\u7684\u4f5c\u7528\u662f\u5bf9\u5c4f\u5e55\u7684\u4eae\u5ea6\u8fdb\u884c\u8c03\u6574\uff0c\u4f7f\u7528\u65b9\u6cd5\u53ea\u9700\u5411\u8be5\u65b9\u6cd5\u4f20\u5165\u4e00\u4e2a\u5bf9\u8c61\uff0c\u5e76\u4e14\u5c06\u5bf9\u8c61\u7684\u201cvalue\u201d\u5c5e\u6027\u8bbe\u7f6e\u4e3a1\u5373\u53ef\u3002 \u793a\u4f8b\u4ee3\u7801 \/\/\u83b7\u53d6\u5e94\u7528\u5b9e\u4f8b var&nbsp;app&nbsp;=&nbsp;getApp() Page({ &nbsp;&nbsp;data:{ &nbsp;&nbsp;}, &nbsp;&nbsp;changeScreenLight:function(e){ &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;that&nbsp;=&nbsp;this; &nbsp;&nbsp;&nbsp;&nbsp;\/\/\u6ed1\u52a8\u62c9\u6746\u83b7\u5f97\u503c &nbsp;&nbsp;&nbsp;&nbsp;wx.setScreenBrightness({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value:&nbsp;parseFloat(e.detail.value).toFixed(1) &nbsp;&nbsp;&nbsp;&nbsp;}) &nbsp;&nbsp;&nbsp;&nbsp;\/\/\u7ed9\u5c4f\u5e55\u4eae\u5ea6\u8d4b\u503c &nbsp;&nbsp;&nbsp;&nbsp;wx.getScreenBrightness({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success:&nbsp;function(res)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that.setData({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ScreenBrightness:&nbsp;res.value &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;}) &nbsp;&nbsp;} }) \u767b\u5f55\u540e\u590d\u5236 \u53c2\u6570\u8bf4\u660e \u53c2\u6570 \u7c7b\u578b \u5fc5\u586b \u8bf4\u660e value Number \u662f \u5c4f\u5e55\u4eae\u5ea6\u503c\uff0c\u8303\u56f4 0~1\uff0c0 \u6700\u6697\uff0c1 \u6700\u4eae success Function \u5426 \u63a5\u53e3\u8c03\u7528\u6210\u529f fail Function \u5426 \u63a5\u53e3\u8c03\u7528\u5931\u8d25\u7684\u56de\u8c03\u51fd\u6570 complete Function \u5426 \u63a5\u53e3\u8c03\u7528\u7ed3\u675f\u7684\u56de\u8c03\u51fd\u6570\uff08\u8c03\u7528\u6210\u529f\u3001\u5931\u8d25\u90fd\u4f1a\u6267\u884c\uff09 \u63a8\u8350\u6559\u7a0b\uff1a\u300a\u300b \u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4eae\u5ea6\u600e\u4e48\u8c03\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-33205","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33205","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=33205"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33205\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}