{"id":29524,"date":"2024-11-25T15:11:07","date_gmt":"2024-11-25T07:11:07","guid":{"rendered":"https:\/\/fwq.ai\/blog\/29524\/"},"modified":"2024-11-25T15:11:07","modified_gmt":"2024-11-25T07:11:07","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%bb%84%e4%bb%b6%ef%bc%9aaction-sheet%e6%98%be%e7%a4%ba%e6%93%8d%e4%bd%9c%e8%8f%9c%e5%8d%95%e8%a7%a3%e8%af%bb%e5%92%8c%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/29524\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\uff1aaction-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u89e3\u8bfb\u548c\u5206\u6790"},"content":{"rendered":"<p style=\"text-align: left\"><strong><span style=\"color:#001000\"><span style=\"font-size:13px\">action-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u7684<\/span><\/span><span style=\"color:#333333\"><span style=\"font-size:13px\">\u7ec4\u4ef6\u8bf4\u660e:<\/span><\/span><\/strong><\/p>\n<ul>\n<li>\n<p style=\"text-align: left\">\u663e\u793a\u64cd\u4f5c\u83dc\u5355<\/p>\n<\/li>\n<\/ul>\n<p style=\"text-align: left\"><strong><span style=\"color:#001000\"><span style=\"font-size:13px\">action-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355<\/span><\/span><span style=\"color:#333333\"><span style=\"font-size:13px\">\u793a\u4f8b\u4ee3\u7801\u8fd0\u884c\u6548\u679c\u5982\u4e0b\uff1a<\/span><\/span><\/strong><\/p>\n<p style=\"text-align: left\"><strong><span style=\"color:#333333\"><span style=\"font-size:13px\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/\/upload\/image\/485\/720\/355\/1490937825402137.gif\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\uff1aaction-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u89e3\u8bfb\u548c\u5206\u6790\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\uff1aaction-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u89e3\u8bfb\u548c\u5206\u6790\u63d2\u56fe\" \/><\/span><\/span><\/strong><\/p>\n<p style=\"line-height:20px;text-indent:nullem;text-align:left\"><span style=\"color:#333333\"><span style=\"font-family:\"><span style=\"font-size:13px\"><span style=\"font-family:\">\u4e0b\u9762\u662fWXML\u4ee3\u7801\uff1a<\/span><\/span><\/span><\/span><\/p>\n<p style=\"text-align: left\"><span><span style=\"font-family:\"><span style=\"font-size:13px\"><\/span><\/span><\/span><\/p>\n<pre>&lt;button type=\"primary\" bindtap=\"actionSheetTap\"&gt;\u5f39\u51faActionSheet&lt;\/button&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"line-height:20px;text-indent:nullem;text-align:left\"><span style=\"color:#333333\"><span style=\"font-family:\"><span style=\"font-size:13px\"><span style=\"font-family:\">\u4e0b\u9762\u662fJS\u4ee3\u7801\uff1a<\/span><\/span><\/span><\/span><\/p>\n<p style=\"text-align: left\"><span><span style=\"font-family:\"><span style=\"font-size:13px\"><\/span><\/span><\/span><\/p>\n<pre>actionSheetTap: function () {\r\n    var itemList= ['A', 'B', 'C']\r\n    wx.showActionSheet({\r\n      itemList:itemList,\r\n      success: function (res) {\r\n        if (!res.cancel) {\r\n          console.log(itemList[res.tapIndex])\r\n        }\r\n      }\r\n    })\r\n  }<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong><span style=\"color:#001000\"><span style=\"font-size:13px\">action-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u7684<\/span><\/span><span style=\"color:#333333\"><span style=\"font-size:13px\">\u4e3b\u8981\u5c5e\u6027\uff1a<\/span><\/span><\/strong><\/p>\n<ul>\n<li>\n<p style=\"text-align: left\">OBJECT\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<\/li>\n<\/ul>\n<table style=\"width:98%\">\n<tbody>\n<tr>\n<td>\n<p style=\"text-align:left\">\u5c5e\u6027<\/p>\n<\/td>\n<td>\n<p style=\"text-align:left\">\u7c7b\u578b<\/p>\n<\/td>\n<td>\n<p style=\"text-align:left\">\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p style=\"text-align:left\">\u8bf4\u660e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>itemList<\/td>\n<td>String Array<\/td>\n<td>\u662f<\/td>\n<td>\u6309\u94ae\u7684\u6587\u5b57\u6570\u7ec4\uff0c\u6570\u7ec4\u957f\u5ea6\u6700\u5927\u4e3a6\u4e2a<\/td>\n<\/tr>\n<tr>\n<td>itemColor<\/td>\n<td>HexColor<\/td>\n<td>\u5426<\/td>\n<td>\u6309\u94ae\u7684\u6587\u5b57\u989c\u8272\uff0c\u9ed8\u8ba4\u4e3a\u201d#000000\u201d<\/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\uff0c\u8be6\u89c1\u8fd4\u56de\u53c2\u6570\u8bf4\u660e<\/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<ul>\n<li>\n<p style=\"text-align: left\">success\u8fd4\u56de\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<\/li>\n<\/ul>\n<table style=\"width: 98%\">\n<tbody>\n<tr>\n<td>\n<p style=\"text-align:left\">\u53c2\u6570<\/p>\n<\/td>\n<td>\n<p style=\"text-align:left\">\u7c7b\u578b<\/p>\n<\/td>\n<td>\n<p style=\"text-align:left\">\u8bf4\u660e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>cancel<\/td>\n<td>Boolean<\/td>\n<td>\u7528\u6237\u662f\u5426\u53d6\u6d88\u9009\u62e9<\/td>\n<\/tr>\n<tr>\n<td>tapIndex<\/td>\n<td>Number<\/td>\n<td>\u7528\u6237\u70b9\u51fb\u7684\u6309\u94ae\uff0c\u4ece\u4e0a\u5230\u4e0b\u7684\u987a\u5e8f\uff0c\u4ece0\u5f00\u59cb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\uff1aaction-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u89e3\u8bfb\u548c\u5206\u6790\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>action-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u7684\u7ec4\u4ef6\u8bf4\u660e: \u663e\u793a\u64cd\u4f5c\u83dc\u5355 action-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u793a\u4f8b\u4ee3\u7801\u8fd0\u884c\u6548\u679c\u5982\u4e0b\uff1a \u4e0b\u9762\u662fWXML\u4ee3\u7801\uff1a &lt;button type=&#8221;primary&#8221; bindtap=&#8221;actionSheetTap&#8221;&gt;\u5f39\u51faActionSheet&lt;\/button&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e0b\u9762\u662fJS\u4ee3\u7801\uff1a actionSheetTap: function () { var itemList= [&#8216;A&#8217;, &#8216;B&#8217;, &#8216;C&#8217;] wx.showActionSheet({ itemList:itemList, success: function (res) { if (!res.cancel) { console.log(itemList[res.tapIndex]) } } }) } \u767b\u5f55\u540e\u590d\u5236 action-sheet\u663e\u793a\u64cd\u4f5c\u83dc\u5355\u7684\u4e3b\u8981\u5c5e\u6027\uff1a OBJECT\u53c2\u6570\u8bf4\u660e\uff1a \u5c5e\u6027 \u7c7b\u578b \u5fc5\u586b \u8bf4\u660e itemList String Array \u662f \u6309\u94ae\u7684\u6587\u5b57\u6570\u7ec4\uff0c\u6570\u7ec4\u957f\u5ea6\u6700\u5927\u4e3a6\u4e2a itemColor HexColor \u5426 \u6309\u94ae\u7684\u6587\u5b57\u989c\u8272\uff0c\u9ed8\u8ba4\u4e3a\u201d#000000\u201d success Function \u5426 \u63a5\u53e3\u8c03\u7528\u6210\u529f\u7684\u56de\u8c03\u51fd\u6570\uff0c\u8be6\u89c1\u8fd4\u56de\u53c2\u6570\u8bf4\u660e fail Function \u5426 [&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-29524","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29524","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=29524"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29524\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=29524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=29524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=29524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}