{"id":33955,"date":"2024-11-25T15:24:40","date_gmt":"2024-11-25T07:24:40","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33955\/"},"modified":"2024-11-25T15:24:40","modified_gmt":"2024-11-25T07:24:40","slug":"%e6%b1%87%e6%80%bb%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%bc%80%e5%8f%91%e4%b8%ad%e9%81%87%e5%88%b0%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33955\/","title":{"rendered":"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/606bcf51d35ea792.jpg\" class=\"aligncenter\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe\" \/><\/p>\n<p>\u5c0f\u7a0b\u5e8f\u9762\u8bd5\u9898<\/p>\n<p><span style=\"color:#ff0000\">1\u3001<\/span><strong><span style=\"color:#ff0000\">bindtap\u548ccatchtap\u7684\u533a\u522b\u662f\u4ec0\u4e48\uff1f<\/span><\/strong><\/p>\n<p><span style=\"color:#333333\">bind<\/span><span style=\"color:#333333\">\u4e8b\u4ef6\u7ed1\u5b9a\u4e0d\u4f1a\u963b\u6b62\u5192\u6ce1\u4e8b\u4ef6\u5411\u4e0a\u5192\u6ce1\uff0c<\/span><span style=\"color:#333333\">catch<\/span><span style=\"color:#333333\">\u4e8b\u4ef6\u7ed1\u5b9a\u53ef\u4ee5\u963b\u6b62\u5192\u6ce1\u4e8b\u4ef6\u5411\u4e0a\u5192\u6ce1<\/span><\/p>\n<p><span style=\"color:#ff0000\">2\u3001<\/span><strong><span style=\"color:#ff0000\">Js\u6570\u7ec4\u8f6c\u6210\u6362\u5b57\u7b26\u4e32\uff0c\u5f3a\u5236\u8f6c\u6362\u6210\u6574\u6570\u53ca\u8f6c\u6362\u6210\u6d6e\u70b9\u6570\u7684\u51fd\u6570\u5206\u522b\u662f\u4ec0\u4e48\uff1f<\/span><\/strong><\/p>\n<p><span style=\"color:#000000\">js\u63d0\u4f9b\u4e86parseInt()\u548cparseFloat()\u4e24\u4e2a\u8f6c\u6362\u51fd\u6570\u3002\u524d\u8005\u628a\u503c\u8f6c\u6362\u6210\u6574\u6570\uff0c\u540e\u8005\u628a\u503c\u8f6c\u6362\u6210\u6d6e\u70b9\u6570\u3002\u53ea\u6709\u5bf9String\u7c7b\u578b\u8c03\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u8fd9\u4e24\u4e2a\u51fd\u6570\u624d\u80fd\u6b63\u786e\u8fd0\u884c\uff1b\u5bf9\u5176\u4ed6\u7c7b\u578b\u8fd4\u56de\u7684\u90fd\u662fNaN(Not a Number)\u3002<\/span><\/p>\n<p><strong>\u76f8\u5173\u514d\u8d39\u5b66\u4e60\u63a8\u8350\uff1a<\/strong><\/p>\n<p><strong><span style=\"color:#000000\">1\u3001\u8f6c\u6362\u51fd\u6570\uff1a<\/span><\/strong><\/p>\n<p><span style=\"color:#000000\">\u5728 \u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u662f\u6570\u5b57\u503c\u524d\uff0cparseInt()\u548cparseFloat()\u90fd\u4f1a\u4ed4\u7ec6\u5206\u6790\u8be5\u5b57\u7b26\u4e32\u3002parseInt()\u65b9\u6cd5\u9996\u5148\u67e5\u770b\u4f4d\u7f6e0\u5904\u7684 \u5b57\u7b26\uff0c\u5224\u65ad\u5b83\u662f\u5426\u662f\u4e2a\u6709\u6548\u6570\u5b57\uff1b\u5982\u679c\u4e0d\u662f\uff0c\u8be5\u65b9\u6cd5\u5c06\u8fd4\u56deNaN\uff0c\u4e0d\u518d\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u4f46\u5982\u679c\u8be5\u5b57\u7b26\u662f\u6709\u6548\u6570\u5b57\uff0c\u8be5\u65b9\u6cd5\u5c06\u67e5\u770b\u4f4d\u7f6e1\u5904\u7684\u5b57\u7b26\uff0c\u8fdb\u884c\u540c\u6837\u7684 \u6d4b\u8bd5\u3002\u8fd9\u4e00\u8fc7\u7a0b\u5c06\u6301\u7eed\u5230\u53d1\u73b0\u975e\u6709\u6548\u6570\u5b57\u7684\u5b57\u7b26\u4e3a\u6b62\uff0c\u6b64\u65f6parseInt()\u5c06\u628a\u8be5\u5b57\u7b26\u4e4b\u524d\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u6210\u6570\u5b57\u3002<\/span><\/p>\n<pre>parseInt(\"1234blue\");&nbsp;\/\/returns&nbsp;1234&nbsp;\nparseInt(\"0xA\");&nbsp;\/\/returns&nbsp;10&nbsp;\nparseInt(\"22.5\");&nbsp;\/\/returns&nbsp;22&nbsp;\nparseInt(\"blue\");&nbsp;\/\/returns&nbsp;NaN<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong><span style=\"color:#000000\">2. \u5f3a\u5236\u7c7b\u578b\u8f6c\u6362<\/span><\/strong><\/p>\n<p><span style=\"color:#000000\">\u8fd8\u53ef\u4f7f\u7528\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\uff08type casting\uff09\u5904\u7406\u8f6c\u6362\u503c\u7684\u7c7b\u578b\u3002\u4f7f\u7528\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u53ef\u4ee5\u8bbf\u95ee\u7279\u5b9a\u7684\u503c\uff0c\u5373\u4f7f\u5b83\u662f\u53e6\u4e00\u79cd\u7c7b\u578b\u7684\u3002<\/span><br \/><span style=\"color:#000000\">ECMAScript\u4e2d\u53ef\u7528\u76843\u79cd\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u5982\u4e0b\uff1a&nbsp;<\/span><br \/><span style=\"color:#000000\">Boolean(value)\u2014\u2014\u628a\u7ed9\u5b9a\u7684\u503c\u8f6c\u6362\u6210Boolean\u578b\uff1b&nbsp;<\/span><br \/><span style=\"color:#000000\">Number(value)\u2014\u2014\u628a\u7ed9\u5b9a\u7684\u503c\u8f6c\u6362\u6210\u6570\u5b57\uff08\u53ef\u4ee5\u662f\u6574\u6570\u6216\u6d6e\u70b9\u6570\uff09\uff1b&nbsp;<\/span><br \/><span style=\"color:#000000\">String(value)\u2014\u2014\u628a\u7ed9\u5b9a\u7684\u503c\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\u3002<\/span><\/p>\n<p><strong><span style=\"color:#000000\">3. \u5229\u7528js\u53d8\u91cf\u5f31\u7c7b\u578b\u8f6c\u6362<\/span><\/strong><\/p>\n<p><span style=\"color:#000000\">\u4e3e\u4e2a\u5c0f\u4f8b\u5b50\uff0c\u4e00\u770b\uff0c\u5c31\u4f1a\u660e\u767d\u4e86\u3002<\/span><br \/><span style=\"color:#000000\"><\/span><span style=\"color:#000000\"><\/span><\/p>\n<pre>&lt;script&gt; \nvar str= &#039;012.345 &#039;; \nvar x = str-0; \nx = x*1;\n&lt;\/script&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color:#000000\">\u4e0a\u4f8b\u5229\u7528\u4e86js\u7684\u5f31\u7c7b\u578b\u7684\u7279\u70b9\uff0c\u53ea\u8fdb\u884c\u4e86\u7b97\u672f\u8fd0\u7b97\uff0c\u5b9e\u73b0\u4e86\u5b57\u7b26\u4e32\u5230\u6570\u5b57\u7684\u7c7b\u578b\u8f6c\u6362\uff0c\u4e0d\u8fc7\u8fd9\u4e2a\u65b9\u6cd5\u8fd8\u662f\u4e0d\u63a8\u8350\u7684\u3002<\/span><\/p>\n<p><span style=\"color:#ff0000\">3\u3001<\/span><strong><span style=\"color:#ff0000\">\u7b80\u5355\u63cf\u8ff0\u4e0b\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u76f8\u5173\u6587\u4ef6\u7c7b\u578b<\/span><\/strong>\u3002<\/p>\n<p>\u5c0f\u7a0b\u5e8f\uff1apages \u2014\u2014index\uff1aindex.js(<span style=\"color:#222222\">\u9875\u9762\u903b\u8f91<\/span>) \/index.wxml (<span style=\"color:#222222\">\u9875\u9762\u7ed3\u6784<\/span>)\/index.wxss (<span style=\"color:#222222\">\u9875\u9762\u6837\u5f0f\u8868<\/span>) \/ index.json (<span style=\"color:#222222\">\u9875\u9762\u914d\u7f6e<\/span>)<\/p>\n<p>App.js &nbsp;&nbsp;<span style=\"color:#222222\">\u5c0f\u7a0b\u5e8f\u903b\u8f91<\/span><\/p>\n<p>App.json &nbsp;<span style=\"color:#222222\">\u5c0f\u7a0b\u5e8f\u516c\u5171\u8bbe\u7f6e<\/span><\/p>\n<p>App.wxss &nbsp;&nbsp;<span style=\"color:#222222\">\u5c0f\u7a0b\u5e8f\u516c\u5171\u6837\u5f0f\u8868<\/span><\/p>\n<p><span style=\"color:#ff0000\">4\u3001<\/span><strong><span style=\"color:#ff0000\">\u5c0f\u7a0b\u5e8f\u6709\u54ea\u4e9b\u53c2\u6570\u4f20\u503c\u7684\u65b9\u6cd5\uff1f<\/span><\/strong><\/p>\n<p>1\u3001\u8bbe\u7f6eid\u7684\u65b9\u6cd5\u6807\u8bc6\u8df3\u8f6c\u540e\u4f20\u9012\u7684\u53c2\u6570\u503c\uff1b<\/p>\n<p>2\u3001\u901a\u8fc7\u4f7f\u7528data &#8211; xxxx \u7684\u65b9\u6cd5\u6765\u6807\u8bc6\u8981\u4f20\u9012\u7684\u503c<\/p>\n<p><strong>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u8bbe\u7f6eid\u7684\u65b9\u6cd5\u6807\u8bc6\u6765\u4f20\u503c<\/strong><\/p>\n<p><span style=\"color:#454545\">\u5728\u8981\u8df3\u8f6c\u7684item\u5904\uff0c\u8bbe\u7f6e\u4e00\u4e2aid\u5e76\u7ed9\u5f53\u524d\u7684id\u8d4b\u503c\u4e0a\u5bf9\u5e94\u7684key\u503c\uff0c\u6bd4\u5982\u4e00\u90e8\u7535\u5f71\u7684id\uff08\u540e\u9762\u5e26\u7740id\u53bb\u4e0b\u4e00\u4e2a\u9875\u9762\u67e5\u8be2\uff0c\u8be6\u7ec6\u4fe1\u606f\uff09\u5982\uff1a<\/span><\/p>\n<p>\u540e\u6211\u4eec\u5728js\u7684bindtap\u7684\u54cd\u5e94\u4e8b\u4ef6\u4e2d\u83b7\u53d6\uff0c\u5e76\u4f20\u9012\u5230\u4e0b\u4e00\u4e2a\u754c\u9762\u4e2d\uff1b<\/p>\n<p><strong>\u83b7\u53d6\u5230id\u4f20\u7684\u503c<\/strong><\/p>\n<p><span style=\"color:#ff0000\">\u901a\u8fc7e.currentTarget.id;\u83b7\u53d6\u8bbe\u7f6e\u7684id\u503c\uff0c\u5e76\u901a\u8fc7\u8bbe\u7f6e\u5168\u5c40\u5bf9\u8c61\u7684\u65b9\u5f0f\u6765\u4f20\u9012\u6570\u503c\uff0c<\/span><\/p>\n<p> \u83b7\u53d6\u5168\u5c40\u5bf9\u8c61<span style=\"color:#ff0000\">&nbsp;var app=getApp();&nbsp;<\/span>\/\/\u8bbe\u7f6e\u5168\u5c40\u7684\u8bf7\u6c42\u8bbf\u95ee\u4f20\u9012\u7684\u53c2\u6570&nbsp;<span style=\"color:#ff0000\">app.requestDetailid=id;<\/span><\/p>\n<p>\u63d0\u793a\uff1a\u5176\u5b9e\u6211\u4eec\u4e5f\u53ef\u4ee5\u5728\uff0cwxml\u4e2d\u67e5\u770b\u5230\u6211\u4eec\u8bbe\u7f6e\u7684\u6bcf\u4e00\u4e2aitem\u7684id\u503c<\/p>\n<p><strong>\u901a\u8fc7\u4f7f\u7528data &#8211; xxxx \u7684\u65b9\u6cd5\u6807\u8bc6\u6765\u4f20\u503c<\/strong><\/p>\n<p><span style=\"color:#454545\">\u901a\u8fc7\u4f7f\u7528data &#8211; xxxx \u7684\u65b9\u6cd5\u6807\u8bc6\u6765\u4f20\u503c\uff0cxxxx\u53ef\u4ee5\u81ea\u5b9a\u4e49\u53d6\u540d \u6bd4\u5982data-key\u7b49\u7b49\u90fd\u53ef\u4ee5\u3002<\/span><\/p>\n<p><strong>\u5982\u4f55\u83b7\u53d6data-xxxx\u4f20\u9012\u7684\u503c\uff1f<\/strong><\/p>\n<p>\u5728js\u7684bindtap\u7684\u54cd\u5e94\u4e8b\u4ef6\u4e2d\uff1a<\/p>\n<p>\u901a\u8fc7\u6570\u636e\u89e3\u6790\u4e00\u5c42\u5c42\u627e\u5230\u6570\u636e\uff0c<span style=\"color:#ff0000\">var id=e.target.dataset.id(\u6839\u636e\u4f60\u7684data-id\u7684\u53d6\u540d)<\/span><\/p>\n<p><strong>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5982\u4f55\u8de8\u9875\u9762\u83b7\u53d6\u503c\uff1f<\/strong><\/p>\n<p><span style=\"color:#b22222\">\u4f9d\u636e\u4e0a\u9762\u7684\u65b9\u5f0f\u8bbe\u7f6e\u8981\u4f20\u9012\u7684\u503c<\/span>\uff0c\u9875\u9762\u8df3\u8f6c\u540e\uff0c\u6211\u4eec\u5c31\u9700\u8981\u5728\u4e0b\u4e00\u4e2a\u9875\u9762\u62ff\u5230\u4f20\u9012\u7684\u6570\u636e\uff08<span style=\"color:#ff0000\">\u8fd9\u4e2a\u6570\u636e\u5728\u4f20\u9012\u524d\uff0c\u5c31\u5df2\u7ecf\u88ab\u8bbe\u7f6e\u6210\u5168\u5c40\u53d8\u91cf<\/span>\uff09<\/p>\n<p>\u5728\u8df3\u8f6c\u540e\u7684js\u9875\u9762\uff0c\u63a5\u6536\u4f20\u9012\u8fc7\u6765\u7684\u6570\u636edetail.js<\/p>\n<p><span style=\"color:#ff0000\">\u540c\u6837\u901a\u8fc7\u5168\u5c40\u989d\u65b9\u5f0f\u53d6\u503c\u51fa\u6765\uff0c<\/span>\uff08\u5373\u548capp.js\u4e2d\u53d6\u67d0\u4e2a\u53d8\u91cf\u7684\u503c\u662f\u4e00\u6837\u7684\uff09<\/p>\n<p><span style=\"color:#ff0000\">var movieid=getApp().MovieDetailid;<\/span><br \/> console.log(movieid);<\/p>\n<p><span style=\"color:#ff0000\">5\u3001<\/span><strong><span style=\"color:#ff0000\">\u7b80\u8ff0\u4e0bwx.navigateTo(), wx.redirectTo(), wx.switchTab(), wx.navigateBack(), wx.reLaunch()\u7684\u533a\u522b\uff1f<\/span><\/strong><\/p>\n<p>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u8df3\u8f6c\u9875\u9762<\/p>\n<p>\u5c0f\u7a0b\u5e8f\u9875\u9762\u67092\u79cd\u8df3\u8f6c\uff0c\u53ef\u4ee5\u5728wxml\u9875\u9762\u6216\u8005js\u4e2d\uff1a<\/p>\n<p>1\uff0c\u5728wxml\u9875\u9762\u4e2d\uff1a<\/p>\n<pre>&lt;navigator&gt;\u8df3\u8f6c\u5230\u65b0\u9875\u9762&lt;\/navigator&gt;&lt;navigator&gt;\u5728\u5f53\u524d\u9875\u6253\u5f00&lt;\/navigator&gt;&lt;navigator&gt;\u5207\u6362\u5230\u9996\u9875Tab&lt;\/navigator&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>&nbsp;<img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img-blog.csdn.net\/2018040800221876?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxNjQ2MjQ5\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe1\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe1\" \/><\/p>\n<p><strong><span style=\"color:#000000\">2\uff0c\u5728js\u9875\u9762\u4e2d\uff1a<\/span><\/strong><\/p>\n<p><strong><span style=\"color:#000000\">\u3010\u6ce8\u610f\u3011<\/span><\/strong><span style=\"color:#000000\">\u6b64\u5904\u6ce8\u610f\u4e24\u4e2a\u5173\u952e\u8bcd \u201c\u5e94\u7528\u5185\u7684\u9875\u9762\u201d \u548c \u201ctabBar\u9875\u9762\u201d\u3002&nbsp; app.json\u6587\u4ef6\u4e2dtabBar\u4e2d\u6ce8\u518c\u8fc7\u7684tab\u9875\uff0c\u5373\u4e3a\u201ctabBar\u9875\u9762\u201d\uff0c\u975etabBar\u4e2d\u6ce8\u518c\u5360\u7528\u7684\u9875\u9762\u5373\u4e3a\u201c\u5e94\u7528\u5185\u7684\u9875\u9762\u201d \u3002 \u5982\u4e0b\u56fe\uff1ahome\u9875\u9762\u4e3a\u201c\u5e94\u7528\u5185\u7684\u9875\u9762\u201d,index\u548clogs\u9875\u9762\u5219\u4e3a \u201ctabBar\u9875\u9762\u201d\u3002<\/span><\/p>\n<p><span style=\"color:#000000\">&nbsp;<img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/e27c3820e854e47cb0b1660c5bb82e7b-1.png\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe2\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe2\" \/><\/span><\/p>\n<p><strong><span style=\"color:#000000\">3,\u5982\u679c\u4e0a\u8ff0\u8df3\u8f6c\u9047\u5230\u8df3\u8f6c\u5931\u8d25\u6216\u65e0\u6548\u7684\u95ee\u9898\uff0c\u8bf7\u8bbf\u95ee\u4e0b\u9762\u94fe\u63a5:<\/span><\/strong><\/p>\n<p><span style=\"color:#0000ff\">wx.navigateTo\/wx.redirectTo \u65e0\u6548<\/span><\/p>\n<p><span style=\"color:#ff0000\">6\u3001<\/span><strong><span style=\"color:#ff0000\">\u5982\u679c\u9700\u8981\u7528\u6237\u6388\u6743\uff0c\u7528\u6237\u9009\u62e9\u62d2\u7edd\u6388\u6743\uff0c\u6b64\u65f6\u5e94\u8be5\u5982\u4f55\u5904\u7406\uff1f<\/span><\/strong><\/p>\n<p>\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u65f6\uff0c\u5f53\u6211\u4eec\u8c03\u7528API &nbsp;wx.getUserInfo(OBJECT) \u65f6\uff0c\u9700\u8981\u7528\u6237\u6388\u6743\u3002\u4f46\u5982\u679c\u7528\u6237\u62d2\u7edd\u6388\u6743\uff0c\u6211\u4eec\u5982\u4f55\u517c\u5bb9\u7528\u6237\u62d2\u7edd\u6388\u6743\u72b6\u6001\uff0c\u62e5\u6709\u66f4\u597d\u7684\u7528\u6237\u4f53\u9a8c\u5462\uff1f<\/p>\n<p>\u5148\u770b\u770b\u8fd9\u4e2a\u63a5\u53e3\u7684\u5b98\u65b9\u6587\u6863\uff1a<\/p>\n<p><strong>wx.getUserInfo(OBJECT)<\/strong><\/p>\n<p>\u83b7\u53d6\u7528\u6237\u4fe1\u606f\uff0c\u9700\u8981\u5148\u8c03\u7528&nbsp;<span style=\"color:#6795b5\">wx.login<\/span>&nbsp;\u63a5\u53e3\u3002<\/p>\n<p><strong>OBJECT\u53c2\u6570\u8bf4\u660e\uff1a<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<p><strong>\u53c2\u6570\u540d<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>\u7c7b\u578b<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>\u5fc5\u586b<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>\u8bf4\u660e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>withCredentials<\/p>\n<\/td>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u662f\u5426\u5e26\u4e0a\u767b\u5f55\u6001\u4fe1\u606f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>success<\/p>\n<\/td>\n<td>\n<p>Function<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u63a5\u53e3\u8c03\u7528\u6210\u529f\u7684\u56de\u8c03\u51fd\u6570<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>fail<\/p>\n<\/td>\n<td>\n<p>Function<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u63a5\u53e3\u8c03\u7528\u5931\u8d25\u7684\u56de\u8c03\u51fd\u6570<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>complete<\/p>\n<\/td>\n<td>\n<p>Function<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u63a5\u53e3\u8c03\u7528\u7ed3\u675f\u7684\u56de\u8c03\u51fd\u6570\uff08\u8c03\u7528\u6210\u529f\u3001\u5931\u8d25\u90fd\u4f1a\u6267\u884c\uff09<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"color:#c7254e\">1.&nbsp;<\/span><span style=\"color:#c7254e\">tip<\/span><span style=\"color:#454545\">:&nbsp;<\/span><span style=\"color:#c7254e\">wx.getUserInfo<\/span><span style=\"color:#454545\">&nbsp;\u63a5\u53e3\u9700\u8981\u7528\u6237\u6388\u6743\uff0c\u8bf7\u517c\u5bb9\u7528\u6237\u62d2\u7edd\u6388\u6743\u7684\u573a\u666f\u3002<\/span><\/p>\n<p>\u6211\u4eec\u5c31\u662f\u8981\u5728\u7528\u6237\u70b9\u51fb\u62d2\u7edd\u7684\u65f6\u5019\uff0c\u5f39\u51fa\u63d0\u793a\u6846\uff0c\u63d0\u793a\u7528\u6237\u4ee5\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u50cf\u4e0b\u9762\u8fd9\u6837\u7684\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/e27c3820e854e47cb0b1660c5bb82e7b-2.png\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe3\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe3\" \/><\/p>\n<p>\u7528\u5177\u4f53\u4ee3\u7801\u5b9e\u73b0\u5c31\u662f\uff0c\u5c06\u5f39\u7a97\u5199\u5728 wx.getUserInfo&nbsp;\u7684fail\u56de\u8c03\u51fd\u6570\u4e2d\uff0c\u50cf\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n<p><span style=\"color:#000000\"><\/span><\/p>\n<pre>wx.getUserInfo({\nsuccess:&nbsp;function&nbsp;(resuser)&nbsp;{\nconsole.log(success)\n},\nfail:&nbsp;function&nbsp;()&nbsp;{\/\/&nbsp;\u8c03\u7528\u5fae\u4fe1\u5f39\u7a97\u63a5\u53e3\nwx.showModal({\ntitle:&nbsp;'\u8b66\u544a',\ncontent:&nbsp;'\u60a8\u70b9\u51fb\u4e86\u62d2\u7edd\u6388\u6743\uff0c\u5c06\u65e0\u6cd5\u6b63\u5e38\u4f7f\u7528******\u7684\u529f\u80fd\u4f53\u9a8c\u3002\u8bf710\u5206\u949f\u540e\u518d\u6b21\u70b9\u51fb\u6388\u6743\uff0c\u6216\u8005\u5220\u9664\u5c0f\u7a0b\u5e8f\u91cd\u65b0\u8fdb\u5165\u3002',\nsuccess:&nbsp;function&nbsp;(res)&nbsp;{\nif&nbsp;(res.confirm)&nbsp;{\nconsole.log('\u7528\u6237\u70b9\u51fb\u786e\u5b9a')\n}\n}\n})\n}\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\u7528\u6237\u5c31\u83b7\u5f97\u4e86\u63d0\u793a\u4fe1\u606f\uff0c\u4f46\u6b64\u65f6\uff0c\u7528\u6237\u8fd8\u662f\u505c\u7559\u5728\u9875\u9762\u7684\uff0c\u5982\u679c\u67d0\u4e9b\u5c55\u793a\u4fe1\u606f\uff0c\u8fd8\u662f\u7ed9\u8981\u7ed9\u7528\u6237\u5c55\u793a\u7684\uff0c\u53ea\u662f\u5728\u8fdb\u884c\u67d0\u4e9b\u64cd\u4f5c\u7684\u65f6\u5019\u8981\u5bf9\u6388\u6743\u8fdb\u884c\u9a8c\u8bc1\u7684\u8bdd\uff0c\u90a3\u5c31\u5f97\u7ee7\u7eed\u4fee\u6539\u6211\u4eec\u7684\u4ee3\u7801\uff0c\u4fdd\u5b58\u7528\u6237\u7684\u767b\u5f55\u6001\uff0c\u5728\u5176\u4ed6\u5730\u65b9\u505a\u9a8c\u8bc1\u4f7f\u7528\u3002<\/p>\n<p>\u7b2c\u4e00\u79cd\u601d\u8def\uff1a<\/p>\n<p>\u4fdd\u5b58\u767b\u5f55\u6001\u8fd9\u91cc\u662f\u8fd9\u6837\u7684\uff0c\u5c06\u7528\u6237\u7684\u767b\u5f55\u4fe1\u606f\u4f20\u7ed9\u540e\u53f0\uff0c\u540e\u53f0\u4fdd\u5b58\u7528\u6237\u4fe1\u606f\uff0c\u540c\u65f6\u7528 open_id \u5728\u540e\u53f0\u6362\u53d6\u4e00\u4e2aSessionId &nbsp;\u7528\u6362\u53d6\u7684\u8fd9\u4e2aSessionId \u5b58\u5728\u7f13\u5b58\uff0c\u505a\u4e3a\u767b\u5f55\u6001\u9a8c\u8bc1\u3002<\/p>\n<p><span style=\"color:#000000\"><\/span><\/p>\n<pre>wx.getUserInfo({\nsuccess:&nbsp;function&nbsp;(resuser)&nbsp;{\nlet&nbsp;userInfo&nbsp;=&nbsp;resuser.userInfo\nthat.healthApi.login(code,&nbsp;userInfo).then(logindata&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u8fd9\u91cc\u5c06\u5fae\u4fe1\u7684\u8bf7\u6c42\u5c01\u88c5\u6210Promiese&nbsp;\u98ce\u683c\nif&nbsp;(logindata.code&nbsp;===&nbsp;0)&nbsp;{\nvar&nbsp;sessionId&nbsp;=&nbsp;logindata.data\/\/&nbsp;\u8c03\u7528\u5fae\u4fe1wechat.setStorage\u5c06\u6362\u56de\u6765\u7684&nbsp;SessionId&nbsp;\u5b58\u5728\u672c\u5730\u7f13\u5b58\nthat.wechat.setStorage('sessionId',&nbsp;sessionId).then(()&nbsp;=&amp;gt;&nbsp;{\nthat.globalData.userInfo&nbsp;=&nbsp;userInfo\ntypeof&nbsp;cb&nbsp;==&nbsp;\"function\"&nbsp;&amp;amp;&amp;amp;&nbsp;cb(that.globalData.userInfo)\n})\n}\n})\n},\nfail:&nbsp;function&nbsp;()&nbsp;{\nwx.showModal({\ntitle:&nbsp;'\u8b66\u544a',\ncontent:&nbsp;'\u60a8\u70b9\u51fb\u4e86\u62d2\u7edd\u6388\u6743\uff0c\u5c06\u65e0\u6cd5\u6b63\u5e38\u4f7f\u7528*****\u7684\u529f\u80fd\u4f53\u9a8c\u3002\u8bf710\u5206\u949f\u540e\u518d\u6b21\u70b9\u51fb\u6388\u6743\uff0c\u6216\u8005\u5220\u9664\u5c0f\u7a0b\u5e8f\u91cd\u65b0\u8fdb\u5165\u3002',\nsuccess:&nbsp;function&nbsp;(res)&nbsp;{\nif&nbsp;(res.confirm)&nbsp;{\nconsole.log('\u7528\u6237\u70b9\u51fb\u786e\u5b9a')\n}\n}\n})\n}\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\u6211\u4eec\u5c06\u767b\u5f55\u6001\u4fdd\u5b58\u5728\u4e86 SessionId \u4e2d\uff0c\u5728\u6bcf\u6b21\u767b\u5f55\u7684\u65f6\u5019\u6211\u4eec\u53ea\u9700\u8981\u518d\u8c03\u7528\u4e00\u4e2a \u68c0\u67e5 SessionId\u7684\u63a5\u53e3\u5c31\u884c\uff0c\u68c0\u67e5\u4e0d\u901a\u8fc7\u518d\u8c03\u5fae\u4fe1\u767b\u5f55\u63a5\u53e3\u3002\u6b64\u5904\u4e0d\u505a\u5ef6\u4f38\u4e86\u3002<\/p>\n<p>\u7b2c\u4e8c\u79cd\u601d\u8def\uff1a<\/p>\n<p>\u57283.29\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u66f4\u65b0\u7684\u7248\u672c\u4e2d\uff0c\u52a0\u5165\u4e86\u8fd9\u6837\u4e00\u6761\u5c5e\u6027<\/p>\n<p>withCredentials \u5b57\u6bb5\u57fa\u7840\u5e93\u7248\u672c 1.1.0 \u5f00\u59cb\u652f\u6301\uff0c\u4f4e\u7248\u672c\u9700\u505a<span style=\"color:#6795b5\">\u517c\u5bb9\u5904\u7406<\/span><\/p>\n<p>\u8fd9\u4e2a\u5b57\u6bb5\u7684\u610f\u601d\u5c31\u662f\u8c03\u7528&nbsp;wx.getUserInfo(OBJECT) \u662f\u5426\u5e26\u4e0a&nbsp;<span style=\"color:#ffffff\">\u767b\u5f55\u6001&nbsp;<\/span>&nbsp;\u7684\u4fe1\u606f\u3002<\/p>\n<p>\u5b98\u65b9\u6587\u6863\u662f\u8fd9\u6837\u89e3\u91ca\u7684\uff1a<\/p>\n<p>withCredentials \u5b57\u6bb5\u57fa\u7840\u5e93\u7248\u672c 1.1.0 \u5f00\u59cb\u652f\u6301\uff0c\u4f4e\u7248\u672c\u9700\u505a<span style=\"color:#6795b5\">\u517c\u5bb9\u5904\u7406<\/span><\/p>\n<p><strong>\u6ce8\uff1a\u5f53 withCredentials \u4e3a true \u65f6\uff0c\u8981\u6c42\u6b64\u524d\u6709\u8c03\u7528\u8fc7 wx.login \u4e14\u767b\u5f55\u6001\u5c1a\u672a\u8fc7\u671f\uff0c\u6b64\u65f6\u8fd4\u56de\u7684\u6570\u636e\u4f1a\u5305\u542b encryptedData, iv \u7b49\u654f\u611f\u4fe1\u606f\uff1b\u5f53 withCredentials \u4e3a false \u65f6\uff0c\u4e0d\u8981\u6c42\u6709\u767b\u5f55\u6001\uff0c\u8fd4\u56de\u7684\u6570\u636e\u4e0d\u5305\u542b encryptedData, iv \u7b49\u654f\u611f\u4fe1\u606f\u3002<\/strong><\/p>\n<p><strong>success\u8fd4\u56de\u53c2\u6570\u8bf4\u660e\uff1a<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<p><strong>\u53c2\u6570<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>\u7c7b\u578b<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>\u8bf4\u660e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>userInfo<\/p>\n<\/td>\n<td>\n<p>OBJECT<\/p>\n<\/td>\n<td>\n<p>\u7528\u6237\u4fe1\u606f\u5bf9\u8c61\uff0c\u4e0d\u5305\u542b openid \u7b49\u654f\u611f\u4fe1\u606f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>rawData<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u4e0d\u5305\u62ec\u654f\u611f\u4fe1\u606f\u7684\u539f\u59cb\u6570\u636e\u5b57\u7b26\u4e32\uff0c\u7528\u4e8e\u8ba1\u7b97\u7b7e\u540d\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"color:#6795b5\">signature<\/span><\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u4f7f\u7528 sha1( rawData + sessionkey ) \u5f97\u5230\u5b57\u7b26\u4e32\uff0c\u7528\u4e8e\u6821\u9a8c\u7528\u6237\u4fe1\u606f\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"color:#6795b5\">encryptedData<\/span><\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u5305\u62ec\u654f\u611f\u6570\u636e\u5728\u5185\u7684\u5b8c\u6574\u7528\u6237\u4fe1\u606f\u7684\u52a0\u5bc6\u6570\u636e\uff0c\u8be6\u7ec6\u89c1<span style=\"color:#6795b5\">\u52a0\u5bc6\u6570\u636e\u89e3\u5bc6\u7b97\u6cd5<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p><span style=\"color:#6795b5\">iv<\/span><\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u52a0\u5bc6\u7b97\u6cd5\u7684\u521d\u59cb\u5411\u91cf\uff0c\u8be6\u7ec6\u89c1<span style=\"color:#6795b5\">\u52a0\u5bc6\u6570\u636e\u89e3\u5bc6\u7b97\u6cd5<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6ce8\uff1a\u9700\u8981\u517c\u5bb9\u5fae\u4fe1\u4f4e\u7248\u672c\uff0c<span style=\"color:#6795b5\">\u5411\u540e\u517c\u5bb9<\/span>\u3002<\/p>\n<p>\u90a3\u4e48\u5229\u7528\u8fd9\u4e2a\u63a5\u53e3\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u62ff\u5230 \u767b\u5f55\u72b6\u6001\uff0c\u5728\u5176\u4ed6\u9700\u8981\u9a8c\u8bc1\u767b\u5f55\u7684\u5730\u65b9\u8fdb\u884c\u63d0\u793a\uff0c\u800c\u5728\u4e0d\u9700\u8981\u6388\u6743\u7684\u5730\u65b9\u8fd8\u53ef\u4ee5\u8ba9\u7528\u6237\u6d4f\u89c8\u5c0f\u7a0b\u5e8f\u3002<\/p>\n<p>\u56de\u5230\u524d\u9762\u7684\u95ee\u9898\uff0c\u5728\u7528\u6237\u70b9\u51fb\u62d2\u7edd\u6388\u6743\u540e\uff0c\u5728\u67d0\u4e9b\u64cd\u4f5c\u65f6\u9700\u8981\u9a8c\u8bc1\u7528\u6237\u662f\u5426\u6388\u6743\u8fc7\uff0c\u5f39\u51fa\u4ea4\u4e92\u4fe1\u606f\uff0c\u90a3\u4e48\u5c31\u5229\u7528\u4e0a\u9762\u7684 SessionId\u6216\u8005&nbsp;<strong>withCredentials&nbsp;<\/strong>\u767b\u5f55\u6001\u8fdb\u884c\u4e0b\u9762\u7684\u64cd\u4f5c\uff1a<\/p>\n<p><span style=\"color:#000000\"><\/span><\/p>\n<pre>applyIn:&nbsp;function&nbsp;applyIn()&nbsp;{\nif&nbsp;(wx.getStorageSync('sessionId'))&nbsp;{&nbsp;&nbsp;\/\/&nbsp;\u6839\u636e\u50a8\u5b58\u7684sessionId&nbsp;\u8fdb\u884c\u9a8c\u8bc1\nwx.navigateTo({\nurl:&nbsp;'familyDoctorApply\/familyDoctorApply?Oid='&nbsp;+&nbsp;this.data.params.Oid&nbsp;+&nbsp;'&amp;amp;title='&nbsp;+&nbsp;this.data.params.title&nbsp;+&nbsp;'&amp;amp;serviceCity='&nbsp;+&nbsp;this.data.array[this.data.index].name&nbsp;+&nbsp;'&amp;amp;productPrice='&nbsp;+&nbsp;this.data.product.productPrice\n});\n}&nbsp;else&nbsp;{\nwx.showModal({\ntitle:&nbsp;'\u8b66\u544a',\ncontent:&nbsp;'\u60a8\u70b9\u51fb\u4e86\u62d2\u7edd\u6388\u6743\uff0c\u65e0\u6cd5\u4f7f\u7528\u6b64\u529f\u80fd\u3002',\nsuccess:&nbsp;function&nbsp;(res)&nbsp;{\nif&nbsp;(res.confirm)&nbsp;{\nconsole.log('\u7528\u6237\u70b9\u51fb\u786e\u5b9a')\n}\n}\n})\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6548\u679c\u50cf\u8fd9\u6837\uff1a<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/e27c3820e854e47cb0b1660c5bb82e7b-3.png\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe4\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe4\" \/><\/p>\n<p>\u8fd9\u6837\u4e00\u4e2a\u7b80\u5355\u5b8c\u6574\u7684\u767b\u5f55\u53ca\u6388\u6743\uff0c\u767b\u5f55\u6001\u4fdd\u5b58\u7b49\u524d\u7aef\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u89e3\u51b3\u65b9\u6848\u5c31\u5b8c\u6210\u4e86\uff0c\u8fd8\u53ef\u4ee5\u7ee7\u7eed\u6269\u5c55\u5230\u767b\u5f55\u6709\u6548\u671f\uff0c\u9000\u51fa\u767b\u5f55\uff0c\u7528\u6237\u6743\u9650\u7b49\u8ddf\u591a\u6269\u5c55\u7684\u5730\u65b9\u3002<\/p>\n<p><span style=\"color:#ff0000\">7\u3001<\/span><strong><span style=\"color:#ff0000\">\u4f60\u5e73\u65f6\u5c01\u88c5\u53ef\u4ee5\u590d\u7528\u7684\u65b9\u6cd5\u5417\uff1f\u4f60\u4f1a\u628a\u53ef\u4ee5\u590d\u7528\u7684\u65b9\u6cd5\u5199\u5728\u54ea\u4e2a\u6587\u4ef6\u91cc\uff1f<\/span><\/strong><\/p>\n<p><span style=\"color:#333333\">\u5176\u5b9e\u53ef\u4ee5\u6a21\u62df\u4e00\u4e9b\u6846\u67b6\u7684\uff0c\u6bd4\u5982bootsrap,\u5199\u4e2ademo\u51fa\u6765\uff0c\u62bd\u51facss\u548cjs,js\u6700\u597d\u62bd\u8c61\u6210\u5bf9\u8c61\uff08\u6784\u9020\u51fd\u6570\uff09\u6216\u8005\u662f\u5e26\u53c2\u6570\u7684\u65b9\u6cd5\uff0c\u7136\u540e\u4f60\u53ea\u8981\u58f0\u660e\u5bf9\u50cf\uff0c\u6216\u8005\u53c2\u6570\u6307\u5b9a\u67d0\u4e2aclass\u6216id\uff0c\u5c31\u53ef\u4ee5\u4e86<\/span><\/p>\n<p><span style=\"color:#333333\">\u5199\u5728html\u6587\u4ef6\u91cc\u6709\u4ec0\u4e48\u4f18\u70b9\u5417\uff1f<\/span><br \/><span style=\"color:#333333\">\u72ec\u7acb\u51fa\u6765\u4f1a\u6709\u4ec0\u4e48\u95ee\u9898\u5417\uff1f\u5c24\u5176\u662f\u8f7d\u5165\u9875\u9762\u7684\u65f6\u5019\uff0c\u5e94\u8be5\u4f1a\u591a\u53d1\u5f88\u591ahttp\u8bf7\u6c42\u5427\uff0c\u4f1a\u4e0d\u4f1a\u9020\u6210\u52a0\u8f7d\u53d8\u6162\uff1f<\/span><\/p>\n<p><span style=\"color:#ff0000\">8\u3001<\/span><strong><span style=\"color:#ff0000\">\u5206\u6790\u4e0b\u5c0f\u7a0b\u5e8f\u7684\u4f18\u52a3\u52bf?<\/span><\/strong><\/p>\n<p><span style=\"color:#333333\">\u5c0f\u7a0b\u5e8f\u662f\u5728\u5fae\u4fe1\u751f\u6001\u53d1\u5c55\u8fc7\u7a0b\u4e2d\u65b0\u51fa\u73b0\u7684\u4e00\u79cd\u5e94\u7528\u5f62\u6001\uff0c\u5c0f\u7a0b\u5e8f\u7684\u5c0f\uff0c\u4ece\u67d0\u79cd\u7a0b\u5ea6\u4e0a\u5df2\u7ecf\u8bf4\u660e\u4e86\u5b83\u7684\u4f53\u91cf\u4e0d\u4f1a\u5f88\u5927\uff0c\u4f46\u662f\u53ef\u4ee5\u5b9e\u73b0\u4e00\u4e9b\u529f\u80fd\u76f8\u5bf9\u7b80\u5355\u3001\u4ea4\u4e92\u76f8\u5bf9\u7b80\u5355\u7684\u670d\u52a1\u9700\u6c42\uff0c\u540c\u65f6\u89e3\u51b3\u4e86App\u957f\u671f\u4ee5\u6765\u591a\u5e73\u53f0\u9002\u914d\u3001\u591a\u5e94\u7528\u5e02\u573a\u5206\u53d1\u3001\u5f00\u53d1\u6210\u672c\u5c45\u9ad8\u4e0d\u4e0b\u7b49\u8bf8\u591a\u65b9\u9762\u7684\u95ee\u9898\u3002\u6240\u4ee5\u5c0f\u7a0b\u5e8f\u3010\u5bc6\u4ef6\u3011\u4f9d\u9760\u5fae\u4fe1\u5e73\u53f0\u548c\u81ea\u8eab\u201c\u9605\u540e\u5373\u711a\u201d\u7684\u529f\u80fd\uff0c\u83b7\u5f97\u4f17\u591a\u5e74\u8f7b\u4eba\u7684\u597d\u8bc4<\/span><\/p>\n<p><strong><span style=\"color:#333333\">\u4f18\u52bf\uff1a<\/span><\/strong><\/p>\n<p>1\uff09\u5bb9\u6613\u4e0a\u624b\uff0c\u53ea\u8981\u4e4b\u524d\u6709HTML+CSS+JS\u57fa\u7840\u77e5\u8bc6\uff0c\u5199\u5c0f\u7a0b\u5e8f\u57fa\u672c\u4e0a\u6ca1\u6709\u5927\u95ee\u9898\uff1b\u5f53\u7136\u5982\u679c\u4e86\u89e3ES6+CSS3\u5219\u5b8c\u5168\u53ef\u4ee5\u7f16\u5199\u51fa\u5373\u7cbe\u7b80\u53c8\u52a8\u611f\u7684\u5c0f\u7a0b\u5e8f\uff1b<\/p>\n<p>2\uff09\u57fa\u672c\u4e0a\u4e0d\u9700\u8981\u8003\u8651\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u53ea\u8981\u5fae\u4fe1\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c\u7684\u673a\u5668\uff0c\u5c31\u53ef\u4ee5\u8fd0\u884c\u5c0f\u7a0b\u5e8f\uff1b<\/p>\n<p>3\uff09\u57fa\u672c\u7ec4\u4ef6\u5e93\u5df2\u7ecf\u6bd4\u8f83\u9f50\u5168\uff1aToast,Loading\u6846,Picker,\u5b9a\u4f4d\u53ca\u5730\u56fe,Image,Input,Checkbox,Text,TextArea,ScrollView\u7b49\u5e38\u7528\u7684\u7ec4\u4ef6\u90fd\u6709\uff0c\u800c\u4e14\u4f7f\u7528\u4e5f\u633a\u7b80\u5355\u3001\u65b9\u4fbf\uff1b<\/p>\n<p>4\uff09\u53d1\u5e03\u3001\u5ba1\u6838\u9ad8\u6548\uff0c\u57fa\u672c\u4e0a\u4e0a\u5348\u53d1\u5e03\u5ba1\u6838\uff0c\u4e0b\u5348\u5c31\u5ba1\u6838\u901a\u8fc7\uff0c\u5347\u7ea7\u7b80\u5355\uff0c\u800c\u4e14\u652f\u6301\u7070\u5ea6\u53d1\u5e03\uff1b<\/p>\n<p>5 ) \u5fae\u4fe1\u5b98\u65b9\u63d0\u4f9b\u4f7f\u7528\u4eba\u6570\u3001\u9891\u7387\u7b49\u6570\u636e\u7edf\u8ba1\uff0c\u5c0f\u7a0b\u5e8fjs\u811a\u672c\u6267\u884c\u9519\u8bef\u65e5\u5fd7\uff1b<\/p>\n<p>6\uff09\u5f00\u53d1\u6587\u6863\u6bd4\u8f83\u5b8c\u5584\uff0c\u5f00\u53d1\u793e\u533a\u6bd4\u8f83\u6d3b\u8dc3\uff1b<\/p>\n<p>7\uff09\u6700\u8fd1\u521a\u5f00\u653e\u7684\u725bx\u529f\u80fd\uff0c\u65b0\u589ewebview\u7ec4\u4ef6\uff0c\u53ef\u4ee5\u5c55\u793a\u7f51\u9875\u5566\uff0c\u8fd9\u4e2a\u6bd4\u8f83\u723d\uff1b<\/p>\n<p>8\uff09\u652f\u6301\u63d2\u4ef6\u5f0f\u5f00\u53d1\uff0c\u4e00\u4e9b\u57fa\u672c\u529f\u80fd\u53ef\u4ee5\u5f00\u53d1\u6210\u63d2\u4ef6\uff0c\u4f9b\u591a\u4e2a\u5c0f\u7a0b\u5e8f\u8c03\u7528\uff1b<\/p>\n<p><strong><span style=\"color:#333333\">\u52a3\u52bf\uff1a<\/span><\/strong><\/p>\n<p>1\uff09\u540e\u53f0\u8c03\u8bd5\u9ebb\u70e6\uff0c\u56e0\u4e3aAPI\u63a5\u53e3\u5fc5\u987bhttps\u8bf7\u6c42\uff0c\u4e14\u516c\u7f51\u5730\u5740\uff0c\u4e5f\u5c31\u662f\u8bf4\u540e\u53f0\u4ee3\u7801\u5fc5\u987b\u53d1\u5e03\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\uff1b\u5f53\u7136\u6211\u4eec\u53ef\u4ee5\u4fee\u6539host\u8fdb\u884cdns\u6620\u5c04\u628a\u8fdc\u7a0b\u670d\u52a1\u5668\u8f6c\u5230\u672c\u5730\uff0c\u6216\u8005\u5f00\u542ftomcat\u8fdc\u7a0b\u8c03\u8bd5\uff1b\u4e0d\u7ba1\u600e\u4e48\u8bf4\u7ec8\u5f52\u8c03\u8bd5\u6bd4\u8f83\u9ebb\u70e6\u3002<\/p>\n<p>2\uff09\u524d\u53f0\u6d4b\u8bd5\u6709\u8bf8\u591a\u5751\uff0c\u6700\u5934\u75bc\u83ab\u8fc7\u4e8e\u6a21\u62df\u5668\u4e0e\u771f\u673a\u663e\u793a\u4e0d\u4e00\u81f4\uff08\u4e4b\u524d\u78b0\u5230\u4e00\u4e2a\u6848\u4f8b\uff0c\u540e\u7eed\u5355\u72ec\u8bb2\u89e3\uff09<\/p>\n<p>3\uff09\u771f\u673a\u6d4b\u8bd5\uff0c\u4e2a\u522b\u529f\u80fd\u5b89\u5353\u548c\u82f9\u679c\u8868\u73b0\u8fe5\u5f02\uff0c\u6211\u4eec\u7684\u5c0f\u7a0b\u5e8f\u91cc\u6709\u5f88\u591a\u9875\u9762\u6709\u5b9a\u4f4d\u529f\u80fd\uff0c\u6a21\u62df\u5668\u548ciphone\u5b9a\u4f4d\u77ac\u95f4\u5b8c\u6210\uff0c\u7136\u800c\u5b89\u5353\u624b\u673a\u5c31\u86cb\u75bc\u4e86\uff0c\u8001\u663e\u793a\u201c\u5b9a\u4f4d\u4e2d&#8230;\u201d\u8981\u5f88\u4e45\u624d\u80fd\u5b9a\u4f4d\u597d\u3002\u540e\u6765\u6ca1\u529e\u6cd5\u53ea\u80fd\u4f18\u5316\uff0c\u51cf\u5c11\u5b9a\u4f4d\u6b21\u6570\u3002<\/p>\n<p>4\uff09native\u7ec4\u4ef6\uff0c\u5c55\u793a\u5f88\u4e0d\u597d\uff0c\u6bd4\u5982textarea\uff0c\u4e0d\u80fd\u5728\u6eda\u52a8\u9875\u9762\u51fa\u73b0\uff0c\u800c\u4e14\u81f3\u4e8e\u9876\u5c42\uff0c\u7ecf\u5e38\u5176\u5b83\u7ec4\u4ef6\u4f1a\u88ab\u5b83\u906e\u6321\uff0c\u70b9\u51fb\u5176\u5b83\u7ec4\u4ef6\u65f6\uff0c\u5c31\u8fdb\u5165textarea\u8f93\u5165\u6846\uff1b\u753b\u5e03\u7ec4\u4ef6\u4e5f\u662f\u5982\u6b64\uff1b<\/p>\n<p>5\uff09\u9875\u9762\u8df3\u8f6c\u6df1\u5ea6\u4e0d\u80fd\u8d85\u8fc75\u4e2a\u9875\u9762\uff0c\u8fd9\u4e2a\u6bd4\u8f83\u9ebb\u70e6\uff0c\u6709\u4e9b\u590d\u6742\u7684\u9875\u9762\u8df3\u8f6c\u6ca1\u6cd5\u5b9e\u73b0\uff0c\u4e0d\u8fc7\u592a\u590d\u6742\u7684\u8bdd\u4e5f\u6709\u6096\u5c0f\u7a0b\u5e8f\u7b80\u5355\u6613\u7528\u7684\u539f\u5219\u5566\uff1b<\/p>\n<p>6\uff09\u5c0f\u7a0b\u5e8f\u5347\u7ea7\u95ee\u9898\uff0c\u5b98\u65b9\u6587\u6863\u8bf4\u4f1a\u81ea\u52a8\u66f4\u65b0\uff0c\u5b9e\u9645\u60c5\u51b5\u5f80\u5f80\u662f\u8981\u5148\u628a\u539f\u6765\u7684\u5c0f\u7a0b\u5e8f\u5220\u9664\u6389\uff0c\u91cd\u65b0\u641c\u7d22\u6dfb\u52a0\uff0c\u624d\u80fd\u52a0\u8f7d\u6700\u65b0\u7248\u672c\uff1b<\/p>\n<p>7\uff09\u9875\u9762\u6e32\u67d3\u7a33\u5b9a\u6027\u6709\u5f85\u63d0\u9ad8\uff0c\u5df2\u7ecf\u597d\u51e0\u6b21\u51fa\u73b0\u90e8\u5206\u7528\u6237\u7684\u9875\u9762\u663e\u793a\u5f02\u5e38\uff0c\u6574\u4e2a\u9875\u9762\u88ab\u653e\u5927\u4e86\u597d\u51e0\u500d\uff0c\u5148\u5220\u9664\u539f\u6765\u5c0f\u7a0b\u5e8f\u518d\u6dfb\u52a0\u56de\u6765\uff0c\u5982\u6b64\u91cd\u590d\u597d\u51e0\u6b21\uff0c\u624d\u80fd\u663e\u793a\u6b63\u5e38\uff1b<\/p>\n<p>8\uff09js\u5f15\u7528\u53ea\u80fd\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\uff0c\u5f88\u86cb\u75bc\uff1b\u57fa\u4e8e\u5b89\u5168\u6027\u53caMINA\u6846\u67b6\u5b9e\u73b0\u539f\u7406\uff0c\u5c0f\u7a0b\u5e8f\u4e2d\u5bf9js\u4f7f\u7528\u505a\u4e86\u5f88\u591a\u9650\u5236\uff0c\u4e0d\u80fd\u4f7f\u7528\uff1anew Function\uff0ceval\uff0cGenerator\uff0c\u4e0d\u80fd\u64cd\u4f5ccookie\uff0c\u4e0d\u80fd\u64cd\u4f5cDOM\uff1b<\/p>\n<p>9\uff09\u5f00\u53d1\u5de5\u5177bug\u6bd4\u8f83\u591a\u4e14\u6548\u7387\u6bd4\u8f83\u4f4e\uff0c\u4e09\u5929\u4e24\u5934\u5347\u7ea7\uff0c\u89e3\u51b3\u8001\u95ee\u9898\u7684\u540c\u65f6\u53c8\u51fa\u73b0\u95ee\u9898\uff1b\u6587\u4ef6\u67e5\u627e\u3001\u8d44\u6e90\u5b9a\u4f4d\u3001\u4ee3\u7801\u7f16\u8f91\u8f83eclipse\u6709\u4e00\u5b9a\u5dee\u8ddd\u3002\u7ecf\u5e38\u51fa\u73b0\u628aa.js\u5f53\u505ab.js\u6765\u4fee\u6539<\/p>\n<p><span style=\"color:#ff0000\">9\u3001<\/span><strong><span style=\"color:#ff0000\">\u8bbe\u7f6e\u503c\u5230\u9875\u9762\u6682\u5b58\u533a\uff08\u5373data\uff09\u91cc\u9762\u7684\u65b9\u6cd5\u6709\u51e0\u79cd\uff1f\u5206\u522b\u662f\u4ec0\u4e48\uff1f\u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/span><\/strong><\/p>\n<p><span style=\"color:#333333\">1. \u4f7f\u7528QueryString\u53d8\u91cf <\/span><br \/><span style=\"color:#333333\">&nbsp;&nbsp;&nbsp;&nbsp;QueryString\u662f\u4e00\u79cd\u975e\u5e38\u7b80\u5355\u7684\u4f20\u503c\u65b9\u5f0f\uff0c\u4ed6\u53ef\u4ee5\u5c06\u4f20\u9001\u7684\u503c\u663e\u793a\u5728\u6d4f\u89c8\u5668\u7684\u5730\u5740\u680f\u4e2d\u3002\u5982\u679c\u662f\u4f20\u9012\u4e00\u4e2a\u6216\u591a\u4e2a\u5b89\u5168\u6027\u8981\u6c42\u4e0d\u9ad8\u6216\u662f\u7ed3\u6784\u7b80\u5355\u7684\u6570\u503c\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u65b9\u6cd5\u3002\u4f46\u662f\u5bf9\u4e8e\u4f20\u9012\u6570\u7ec4\u6216\u5bf9\u8c61\u7684\u8bdd\uff0c\u5c31\u4e0d\u80fd\u7528\u8fd9\u4e2a\u65b9\u6cd5\u4e86\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\uff1a <\/span><br \/><span style=\"color:#333333\">a.aspx\u7684C#\u4ee3\u7801 <\/span><br \/><span style=\"color:#333333\"><\/span><span style=\"color:#333333\"><\/span><\/p>\n<pre>private&nbsp;void&nbsp;Button1_Click(object&nbsp;sender,&nbsp;System.EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;string&nbsp;s_url;&nbsp;\n&nbsp;s_url&nbsp;=&nbsp;\"b.aspx?name=\"&nbsp;+&nbsp;Label1.Text;&nbsp;\n&nbsp;Response.Redirect(s_url);&nbsp;\n}&nbsp;\nb.aspx\u4e2dC#\u4ee3\u7801&nbsp;\nprivate&nbsp;void&nbsp;Page_Load(object&nbsp;sender,&nbsp;EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;Label2.Text&nbsp;=&nbsp;Request.QueryString[\"name\"];&nbsp;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color:#333333\">2. \u4f7f\u7528Application \u5bf9\u8c61\u53d8\u91cf <\/span><br \/><span style=\"color:#333333\">&nbsp;&nbsp;&nbsp;&nbsp;Application\u5bf9\u8c61\u7684\u4f5c\u7528\u8303\u56f4\u662f\u6574\u4e2a\u5168\u5c40\uff0c\u4e5f\u5c31\u662f\u8bf4\u5bf9\u6240\u6709\u7528\u6237\u90fd\u6709\u6548\u3002\u5176\u5e38\u7528\u7684\u65b9\u6cd5\u7528Lock\u548cUnLock\u3002 <\/span><br \/><span style=\"color:#333333\">a.aspx\u7684C#\u4ee3\u7801 <\/span><br \/><span style=\"color:#333333\"><\/span><\/p>\n<pre>private&nbsp;void&nbsp;Button1_Click(object&nbsp;sender,&nbsp;System.EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;Application[\"name\"]&nbsp;=&nbsp;Label1.Text;&nbsp;\n&nbsp;Server.Transfer(\"b.aspx\");&nbsp;\n}&nbsp;\nb.aspx\u4e2dC#\u4ee3\u7801&nbsp;\nprivate&nbsp;void&nbsp;Page_Load(object&nbsp;sender,&nbsp;EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;string&nbsp;name;&nbsp;\n&nbsp;Application.Lock();&nbsp;\n&nbsp;name&nbsp;=&nbsp;Application[\"name\"].ToString();&nbsp;\n&nbsp;Application.UnLock();&nbsp;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color:#333333\">3. \u4f7f\u7528Session\u53d8\u91cf <\/span><br \/><span style=\"color:#333333\">&nbsp;&nbsp;&nbsp;&nbsp;\u60f3\u5fc5\u8fd9\u4e2a\u80af\u5b9a\u662f\u5927\u5bb6\u4f7f\u7528\u4e2d\u6700\u5e38\u89c1\u7684\u7528\u6cd5\u4e86\uff0c\u5176\u64cd\u4f5c\u4e0eApplication\u7c7b\u4f3c\uff0c\u4f5c\u7528\u4e8e\u7528\u6237\u4e2a\u4eba\uff0c\u6240\u4ee5\uff0c\u8fc7\u91cf\u7684\u5b58\u50a8\u4f1a\u5bfc\u81f4\u670d\u52a1\u5668\u5185\u5b58\u8d44\u6e90\u7684\u8017\u5c3d\u3002 <\/span><br \/><span style=\"color:#333333\">a.aspx\u7684C#\u4ee3\u7801 <\/span><br \/><span style=\"color:#333333\"><\/span><span style=\"color:#333333\"><\/span><\/p>\n<pre>private&nbsp;void&nbsp;Button1_Click(object&nbsp;sender,&nbsp;System.EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;Session[\"name\"]&nbsp;=&nbsp;Label.Text;&nbsp;\n}&nbsp;\nb.aspx\u4e2dC#\u4ee3\u7801&nbsp;\nprivate&nbsp;void&nbsp;Page_Load(object&nbsp;sender,&nbsp;EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;string&nbsp;name;&nbsp;\n&nbsp;name&nbsp;=&nbsp;Session[\"name\"].ToString();&nbsp;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color:#333333\">4. \u4f7f\u7528Cookie\u5bf9\u8c61\u53d8\u91cf <\/span><br \/><span style=\"color:#333333\">&nbsp;&nbsp;&nbsp;&nbsp;\u8fd9\u4e2a\u4e5f\u662f\u5927\u5bb6\u5e38\u4f7f\u7528\u7684\u65b9\u6cd5\uff0c\u4e0eSession\u4e00\u6837\uff0c\u5176\u662f\u4ec0\u5bf9\u6bcf\u4e00\u4e2a\u7528\u6237\u800c\u8a00\u7684\uff0c\u4f46\u662f\u6709\u4e2a\u672c\u8d28\u7684\u533a\u522b\uff0c\u5373Cookie\u662f\u5b58\u653e\u5728\u5ba2\u6237\u7aef\u7684\uff0c\u800csession\u662f\u5b58\u653e\u5728\u670d\u52a1\u5668\u7aef\u7684\u3002\u800c\u4e14Cookie\u7684\u4f7f\u7528\u8981\u914d\u5408ASP.NET\u5185\u7f6e\u5bf9\u8c61Request\u6765\u4f7f\u7528\u3002<\/span><br \/><span style=\"color:#333333\">a.aspx\u7684C#\u4ee3\u7801 <\/span><br \/><span style=\"color:#333333\"><\/span><span style=\"color:#333333\"><\/span><\/p>\n<pre>private&nbsp;void&nbsp;Button1_Click(object&nbsp;sender,&nbsp;System.EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;HttpCookie&nbsp;cookie_name&nbsp;=&nbsp;new&nbsp;HttpCookie(\"name\");&nbsp;\n&nbsp;cookie_name.Value&nbsp;=&nbsp;Label1.Text;&nbsp;\n&nbsp;Reponse.AppendCookie(cookie_name);&nbsp;\n&nbsp;Server.Transfer(\"b.aspx\");&nbsp;\n}&nbsp;\nb.aspx\u4e2dC#\u4ee3\u7801&nbsp;\nprivate&nbsp;void&nbsp;Page_Load(object&nbsp;sender,&nbsp;EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;string&nbsp;name;&nbsp;\n&nbsp;name&nbsp;=&nbsp;Request.Cookie[\"name\"].Value.ToString();&nbsp;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color:#333333\">5. \u4f7f\u7528Server.Transfer\u65b9\u6cd5 <\/span><br \/><span style=\"color:#333333\">&nbsp;&nbsp;&nbsp;&nbsp;\u8fd9\u4e2a\u624d\u53ef\u4ee5\u8bf4\u662f\u9762\u8c61\u5bf9\u8c61\u5f00\u53d1\u6240\u4f7f\u7528\u7684\u65b9\u6cd5\uff0c\u5176\u4f7f\u7528Server.Transfer\u65b9\u6cd5\u628a\u6d41\u7a0b\u4ece\u5f53\u524d\u9875\u9762\u5f15\u5bfc\u5230\u53e6\u4e00\u4e2a\u9875\u9762\u4e2d\uff0c\u65b0\u7684\u9875\u9762\u4f7f\u7528\u524d\u4e00\u4e2a\u9875\u9762\u7684\u5e94\u7b54\u6d41\uff0c\u6240\u4ee5\u8fd9\u4e2a\u65b9\u6cd5\u662f\u5b8c\u5168\u9762\u8c61\u5bf9\u8c61\u7684\uff0c\u7b80\u6d01\u6709\u6548\u3002 <\/span><br \/><span style=\"color:#333333\">a.aspx\u7684C#\u4ee3\u7801 <\/span><br \/><span style=\"color:#333333\"><\/span><span style=\"color:#333333\"><\/span><\/p>\n<pre>public&nbsp;string&nbsp;Name&nbsp;\n{&nbsp;\n&nbsp;get{&nbsp;return&nbsp;Label1.Text;}&nbsp;\n}&nbsp;\nprivate&nbsp;void&nbsp;Button1_Click(object&nbsp;sender,&nbsp;System.EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;Server.Transfer(\"b.aspx\");&nbsp;\n}&nbsp;\nb.aspx\u4e2dC#\u4ee3\u7801&nbsp;\nprivate&nbsp;void&nbsp;Page_Load(object&nbsp;sender,&nbsp;EventArgs&nbsp;e)&nbsp;\n{&nbsp;\n&nbsp;a&nbsp;newWeb;&nbsp;\/\/\u5b9e\u4f8ba\u7a97\u4f53&nbsp;\n&nbsp;newWeb&nbsp;=&nbsp;(source)Context.Handler;&nbsp;\n&nbsp;string&nbsp;name;&nbsp;\n&nbsp;name&nbsp;=&nbsp;newWeb.Name;&nbsp;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong><span style=\"color:#2c3033\">\u5fae\u4fe1\u5c0f\u7a0b\u5e8f&#8211;data\u7684\u8d4b\u503c\u4e0e\u53d6\u503c<\/span><\/strong><\/p>\n<p><strong>\u901a\u8fc7\u5c0f\u7a0b\u5e8f\u5b98\u65b9\u6587\u6863\u53ef\u77e5\uff1a<\/strong><\/p>\n<p><span style=\"color:#999999\">Page() \u51fd\u6570\u7528\u6765\u6ce8\u518c\u4e00\u4e2a\u9875\u9762\u3002\u63a5\u53d7\u4e00\u4e2a object \u53c2\u6570\uff0c\u5176\u6307\u5b9a\u9875\u9762\u7684\u521d\u59cb\u6570\u636e\u3001\u751f\u547d\u5468\u671f\u51fd\u6570\u3001\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u7b49\u3002\u5176\u4e2d\u7684\u53c2\u6570data\u7528\u6765\u8bbe\u7f6e\u521d\u59cb\u6570\u636e\uff0cWXML \u4e2d\u7684\u52a8\u6001\u6570\u636e\u5747\u6765\u81ea\u5bf9\u5e94 Page \u7684 data\u3002<\/span><\/p>\n<p><strong>\u6240\u4ee5\u5982\u679c\u9875\u9762\u9700\u8981\u663e\u793a\u52a8\u6001\u6570\u636e\u5fc5\u987b\u8981\u628a\u6570\u636e\u66f4\u65b0\u5230data\u4e2d\u5bf9\u5e94\u7684\u53d8\u91cf\u4e2d\u3002<\/strong><\/p>\n<p><span style=\"color:#454545\">\u9875\u9762js\u6587\u4ef6\u4e2d\u8fd9\u4e48\u5199\uff1a<\/span><\/p>\n<pre>Page({\n&nbsp;&nbsp;data:&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;'Hello&nbsp;MINA!'\n&nbsp;&nbsp;}\n})\n\u00b7&nbsp;wxml\u4e2d\u8fd9\u4e48\u5199\uff1a\n&lt;view&gt;&nbsp;{{&nbsp;message&nbsp;}}&nbsp;&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color:#454545\">\u5982\u679c\u8be5\u6570\u636e\u5728\u64cd\u4f5c\u8fc7\u7a0b\u4e2d\u53d1\u751f\u53d8\u5316\uff0c\u9700\u8981\u5c06\u65b0\u6570\u636e\u91cd\u65b0\u7ed1\u5b9a\u5230\u8be5\u53d8\u91cf\u4e2d\uff0c\u5199\u6cd5\u5982\u4e0b\uff1a<\/span><\/p>\n<p><span style=\"color:#000088\"><\/span><\/p>\n<pre>function&nbsp;setData(){\n&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;that&nbsp;=&nbsp;this;\n&nbsp;&nbsp;&nbsp;&nbsp;that.setData({\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;'\u65b0\u6d88\u606f'\n&nbsp;&nbsp;&nbsp;&nbsp;})\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color:#454545\">\u5982\u679c\u60f3\u5728js\u6587\u4ef6\u4e2d\u4f7f\u7528data\u4e2d\u7684\u6570\u636e\u5199\u6cd5\u5982\u4e0b\uff1a<\/span><\/p>\n<p><span style=\"color:#000088\"><\/span><\/p>\n<pre>function&nbsp;getData(){\n&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;that&nbsp;=&nbsp;this;\n&nbsp;&nbsp;&nbsp;&nbsp;console.log(that.data.message)\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color:#ff0000\">10\u3001<\/span><strong><span style=\"color:#ff0000\">\u5982\u4f55\u68c0\u6d4b\u7528\u6237\u7684\u5fae\u4fe1\u7248\u672c\u662f\u5426\u652f\u6301\u67d0\u9879\u529f\u80fd\uff1f<\/span><\/strong><\/p>\n<blockquote><p>\n  \u7b2c\u4e00\u671f\u5f00\u653e\u7684\u63a5\u53e3\uff0c\u4e0d\u662f\u4e0d\u80fd\u4f7f\u7528\uff0c\u800c\u662f\u65e0\u9700\u68c0\u6d4b\uff0c\u5168\u90e8\u90fd\u662f\u652f\u6301\u7684\u3002\u53ea\u6709\u540e\u9762\u6700\u65b0\u5f00\u653e\u7684\u4e00\u4e9b\u63a5\u53e3\uff0c\u624d\u9700\u8981\u68c0\u6d4b\u662f\u5426\u652f\u6301\u3002\u76ee\u524d\u5f00\u653e\u7684\u6240\u6709\u63a5\u53e3\uff1aonMenuShareTimelineonMenuShareAppMessageonMenuShareQQonMenuShareWeiboonMenuShareQZonestartRecordstopRecordonVoiceRecordEndplayVoicepauseVoicestopVoiceonVoicePlayEnduploadVoicedownloadVoicechooseImagepreviewImageuploadImagedownloadImagetranslateVoicegetNetworkTypeopenLocationgetLocationhideOptionMenushowOptionMenuhideMenuItemsshowMenuItemshideAllNonBaseMenuItemshowAllNonBaseMenuItemcloseWindowscanQRCodechooseWXPayopenProductSpecificViewaddCardchooseCardopenCard\n<\/p><\/blockquote>\n<p><strong><span style=\"color:#ff0000\">&nbsp;<img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/c3d4787c398d527a873f6082022468ee-4.png\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe5\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe5\" \/><\/span><\/strong><\/p>\n<p><span style=\"color:#ff0000\">11\u3001<\/span><strong><span style=\"color:#ff0000\">\u5982\u4f55\u5206\u5305\u52a0\u8f7d\uff1f\u5206\u5305\u52a0\u8f7d\u7684\u4f18\u52bf\u5728\u54ea\uff1f<\/span><\/strong><\/p>\n<p><strong><span style=\"color:#666666\">\u5206\u5305\u52a0\u8f7d\u7684\u4ecb\u7ecd<\/span><\/strong><br \/><span style=\"color:#666666\">&nbsp; &nbsp; &nbsp; \u5927\u90e8\u5206\u5c0f\u7a0b\u5e8f\u90fd\u4f1a\u7531\u67d0\u51e0\u4e2a\u529f\u80fd\u7ec4\u6210\uff0c\u901a\u5e38\u8fd9\u51e0\u4e2a\u529f\u80fd\u4e4b\u95f4\u662f\u72ec\u7acb\u7684\uff0c\u4f46\u4f1a\u4f9d\u8d56\u4e00\u4e9b\u516c\u5171\u7684\u903b\u8f91\uff0c\u5e76\u4e14\u8fd9\u4e9b\u529f\u80fd\u901a\u5e38\u4f1a\u5bf9\u5e94\u67d0\u51e0\u4e2a\u72ec\u7acb\u7684\u9875\u9762\u3002\u90a3\u4e48\u5c0f\u7a0b\u5e8f\u4ee3\u7801\u7684\u6253\u5305\uff0c\u5927\u53ef\u4e0d\u5fc5\u4e00\u5b9a\u8981\u6253\u6210\u4e00\u4e2a\uff0c\u53ef\u4ee5\u6309\u7167\u529f\u80fd\u7684\u5212\u5206\uff0c\u62c6\u5206\u6210\u51e0\u4e2a\u5206\u5305\uff0c\u5f53\u9700\u8981\u7528\u5230\u67d0\u4e2a\u529f\u80fd\u65f6\uff0c\u624d\u52a0\u8f7d\u8fd9\u4e2a\u529f\u80fd\u5bf9\u5e94\u7684\u5206\u5305\u3002<\/span><br \/><span style=\"color:#666666\">\u5bf9\u4e8e\u7528\u6237\u6765\u8bf4\uff0c\u5c0f\u7a0b\u5e8f\u52a0\u8f7d\u6d41\u7a0b\u53d8\u6210\u4e86\uff1a<\/span><br \/><span style=\"color:#666666\">1.\u9996\u6b21\u542f\u52a8\u65f6\uff0c\u5148\u4e0b\u8f7d\u5c0f\u7a0b\u5e8f\u4e3b\u5305\uff0c\u663e\u793a\u4e3b\u5305\u5185\u7684\u9875\u9762\uff1b<\/span><br \/><span style=\"color:#666666\">2.\u5982\u679c\u7528\u6237\u8fdb\u5165\u4e86\u67d0\u4e2a\u5206\u5305\u7684\u9875\u9762\uff0c\u518d\u4e0b\u8f7d\u8fd9\u4e2a\u5bf9\u5e94\u5206\u5305\uff0c\u4e0b\u8f7d\u5b8c\u6bd5\u540e\uff0c\u663e\u793a\u5206\u5305\u7684\u9875\u9762\u3002<\/span><br \/><span style=\"color:#666666\">\u91c7\u7528\u5206\u5305\u52a0\u8f7d\uff0c\u5bf9\u5f00\u53d1\u8005\u800c\u8a00\uff0c\u80fd\u4f7f\u5c0f\u7a0b\u5e8f\u6709\u66f4\u5927\u7684\u4ee3\u7801\u4f53\u79ef\uff0c\u627f\u8f7d\u66f4\u591a\u7684\u529f\u80fd\u4e0e\u670d\u52a1\uff1b\u800c\u5bf9\u7528\u6237\u800c\u8a00\uff0c\u53ef\u4ee5\u66f4\u5feb\u5730\u6253\u5f00\u5c0f\u7a0b\u5e8f\uff0c\u540c\u65f6\u5728\u4e0d\u5f71\u54cd\u542f\u52a8\u901f\u5ea6\u524d\u63d0\u4e0b\u4f7f\u7528\u66f4\u591a\u529f\u80fd\u3002<\/span><br \/><strong><span style=\"color:#666666\">\u5206\u5305\u7684\u5212\u5206<\/span><\/strong><br \/><span style=\"color:#666666\">\u5728\u914d\u7f6e\u524d\u9996\u5148\u9700\u8981\u5f00\u53d1\u8005\u89c4\u5212\u4e0b\u5404\u4e2a\u5206\u5305\u9700\u8981\u5bb9\u7eb3\u7684\u5185\u5bb9\uff0c\u6211\u4eec\u5efa\u8bae\u5f00\u53d1\u8005\u6309\u7167\u529f\u80fd\u5212\u5206\u7684\u7684\u539f\u5219\uff0c\u5c06\u540c\u4e00\u4e2a\u529f\u80fd\u4e0b\u7684\u9875\u9762\u548c\u903b\u8f91\u653e\u7f6e\u4e8e\u540c\u4e00\u4e2a\u76ee\u5f55\u4e0b\uff0c\u5bf9\u4e8e\u4e00\u4e9b\u8de8\u529f\u80fd\u4e4b\u95f4\u516c\u5171\u903b\u8f91\uff0c\u5c06\u5176\u653e\u7f6e\u4e8e\u4e3b\u5305\u4e0b\uff0c\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u5728\u5206\u5305\u5f15\u7528\u8fd9\u90e8\u5206\u529f\u80fd\u65f6\uff0c\u8fd9\u90e8\u5206\u7684\u903b\u8f91\u4e00\u5b9a\u5b58\u5728\u3002<\/span><br \/><span style=\"color:#666666\">\u5728\u5206\u5305\u5212\u5206\u65f6\uff0c\u5e94\u8be5\u6ce8\u610f\u4ee5\u4e0b\u4e8b\u9879\uff1a<\/span><br \/><span style=\"color:#666666\">1.\u907f\u514d\u5206\u5305\u4e0e\u5206\u5305\u4e4b\u95f4\u5f15\u7528\u4e0a\u7684\u8026\u5408\u3002\u56e0\u4e3a\u5206\u5305\u7684\u52a0\u8f7d\u662f\u7531\u7528\u6237\u64cd\u4f5c\u89e6\u53d1\u7684\uff0c\u5e76\u4e0d\u80fd\u786e\u4fdd\u67d0\u5206\u5305\u52a0\u8f7d\u65f6\uff0c\u53e6\u5916\u4e00\u4e2a\u5206\u5305\u5c31\u4e00\u5b9a\u5b58\u5728\uff0c\u8fd9\u4e2a\u65f6\u5019\u53ef\u80fd\u4f1a\u5bfc\u81f4 JS \u903b\u8f91\u5f02\u5e38\u7684\u60c5\u51b5\uff0c\u4f8b\u5982\u62a5\u300c&#8221;xxx.js&#8221; is not defined\u300d\u8fd9\u6837\u7684\u9519\u8bef\uff1b<\/span><br \/><span style=\"color:#666666\">2.\u4e00\u4e9b\u516c\u5171\u7528\u5230\u7684\u81ea\u5b9a\u4e49\u7ec4\u4ef6\uff0c\u9700\u8981\u653e\u5728\u4e3b\u5305\u5185\u3002<\/span><br \/><strong><span style=\"color:#666666\">\u5206\u5305\u7684\u914d\u7f6e<\/span><\/strong><br \/><span style=\"color:#666666\">&nbsp; &nbsp; &nbsp; \u5f53\u7406\u6e05\u4e86\u5206\u5305\u7684\u5212\u5206\u540e\uff0c\u5c31\u53ef\u4ee5\u8fdb\u884c\u5206\u5305\u7684\u914d\u7f6e\u4e86\uff0c\u8fd9\u4e00\u6b65\u5e76\u4e0d\u590d\u6742\u3002<\/span><\/p>\n<p><span style=\"color:#666666\">&nbsp; &nbsp; &nbsp; \u5047\u8bbe\u652f\u6301\u5206\u5305\u7684\u5c0f\u7a0b\u5e8f\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b\uff1a<\/span><\/p>\n<p><span style=\"color:#666666\">&nbsp;<img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/c3d4787c398d527a873f6082022468ee-5.png\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe6\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe6\" \/><\/span><\/p>\n<p><span style=\"color:#666666\">&nbsp; &nbsp; &nbsp;<\/span><span style=\"color:#666666\">\u5f00\u53d1\u8005\u901a\u8fc7\u5728 app.json<\/span><span style=\"color:#666666\">&nbsp;<\/span><span style=\"color:#666666\">subPackages<\/span><span style=\"color:#666666\">&nbsp;<\/span><span style=\"color:#666666\">\u5b57\u6bb5\u58f0\u660e\u9879\u76ee\u5206\u5305\u7ed3\u6784\uff1a<\/span><\/p>\n<p><span style=\"color:#666666\"><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/c3d4787c398d527a873f6082022468ee-6.png\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe7\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe7\" \/><\/span><\/p>\n<p><strong><span style=\"color:#666666\">\u5206\u5305\u52a0\u8f7d\u7684\u4f4e\u7248\u672c\u517c\u5bb9\u95ee\u9898<\/span><\/strong><br \/><span style=\"color:#666666\">&nbsp; &nbsp;\u5fae\u4fe1 6.6.0 \u7248\u672c\u5f00\u59cb\u652f\u6301\u5206\u5305\u52a0\u8f7d\uff0c\u800c\u5bf9\u4e8e\u4f4e\u4e8e\u8fd9\u4e2a\u7248\u672c\u7684\u5ba2\u6237\u7aef\uff0c\u6211\u4eec\u505a\u4e86\u517c\u5bb9\u5904\u7406\uff0c\u5f00\u53d1\u8005\u4e0d\u9700\u8981\u5bf9\u8001\u7248\u672c\u5fae\u4fe1\u5ba2\u6237\u7aef\u505a\u517c\u5bb9\u3002\u5bf9\u4e8e\u8001\u7248\u672c\u7684\u5ba2\u6237\u7aef\uff0c\u7f16\u8bd1\u540e\u53f0\u4f1a\u5c06\u6240\u6709\u7684\u5206\u5305\u6253\u5305\u6210\u4e00\u4e2a\u6574\u5305\uff0c\u8001\u7248\u672c\u7684\u5ba2\u6237\u7aef\u4f9d\u7136\u6309\u7167\u6574\u5305\u7684\u65b9\u5f0f\u8fdb\u884c\u52a0\u8f7d\u3002<\/span><br \/><span style=\"color:#666666\">\u6240\u4ee5\u5728\u8001\u7248\u672c\u7684\u5fae\u4fe1\u5ba2\u6237\u7aef\u4e0b\uff0c\u662f\u4f9d\u7136\u91c7\u53d6\u6574\u5305\u52a0\u8f7d\u7684\u65b9\u5f0f\u52a0\u8f7d\u7684\uff0c\u5efa\u8bae\u5f00\u53d1\u8005\u5c3d\u91cf\u63a7\u5236\u4ee3\u7801\u5305\u7684\u5927\u5c0f\u3002<\/span><br \/><span style=\"color:#666666\">\u76ee\u524d\u5c0f\u7a0b\u5e8f\u5206\u5305\u5927\u5c0f\u7684\u9650\u5236\uff1a<\/span><br \/><span style=\"color:#666666\">&nbsp; &nbsp; \u6574\u4e2a\u5c0f\u7a0b\u5e8f\u6240\u6709\u5206\u5305\u5927\u5c0f\u4e0d\u8d85\u8fc7 4M<\/span><br \/><span style=\"color:#666666\">&nbsp; &nbsp; \u5355\u4e2a\u5206\u5305\/\u4e3b\u5305\u5927\u5c0f\u4e0d\u80fd\u8d85\u8fc7 2M<\/span><br \/><span style=\"color:#666666\">&nbsp; &nbsp;\u968f\u7740\u65f6\u95f4\u63a8\u79fb\uff0c\u8001\u7248\u672c\u8986\u76d6\u7387\u964d\u4f4e\uff0c\u6211\u4eec\u4f1a\u8003\u8651\u8fdb\u4e00\u6b65\u6269\u5927\u4ee3\u7801\u5305\u7684\u5927\u5c0f\u3002<\/span><\/p>\n<p><span style=\"color:#ff0000\">12\u3001<\/span><strong><span style=\"color:#ff0000\">\u5728\u4f60\u5f00\u53d1\u5c0f\u7a0b\u5e8f\u7684\u8fc7\u7a0b\u4e2d\u9047\u5230\u8fc7\u4ec0\u4e48\u5751\uff1f \u4f60\u662f\u600e\u4e48\u89e3\u51b3\u7684\uff1f<\/span><\/strong><\/p>\n<p>1.\u6211\u4eec\u4f7f\u7528app.json\u6587\u4ef6\u6765\u5bf9\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u8fdb\u884c\u5168\u5c40\u914d\u7f6e\uff0c\u51b3\u5b9a\u9875\u9762\u6587\u4ef6\u7684\u8def\u5f84\u3001\u7a97\u53e3\u8868\u73b0\u3001\u8bbe\u7f6e\u7f51\u7edc\u8d85\u65f6\u65f6\u95f4\u3001\u8bbe\u7f6e\u591a tab \u7684\u65f6\u5019\u5728pages\u4e2d\u5199\u6ce8\u91ca\u7684\u65f6\u5019\u56de\u62a5\u9519\u3002&nbsp;<br \/> \u4f8b\u5982\uff1a<\/p>\n<p><span style=\"color:#000000\"><\/span><\/p>\n<pre>{\n&nbsp;&nbsp;\"pages\":[\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8fd9\u662f\u9996\u9875\u9762\n&nbsp;&nbsp;&nbsp;&nbsp;\"pages\/welcome\/welcome\"\n&nbsp;&nbsp;]}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u65f6\u5c31\u4f1a\u62a5\u9519&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/f7eb40c4efdd9ae0b52c00c7709a7e4e-7.png\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe8\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe8\" \/><br \/> 2.\u5728json\u6587\u4ef6\u4e2d\u6ca1\u6709\u5199\u5185\u5bb9\u7684\u65f6\u5019\u4e5f\u8981\u52a0\u4e00\u5bf9\u5927\u62ec\u53f7{ }\uff0c\u4e0d\u7136\u7684\u8bdd\u4e5f\u4f1a\u62a5\u9519&nbsp;<br \/> &nbsp;<img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/f7eb40c4efdd9ae0b52c00c7709a7e4e-8.png\" title=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe9\" alt=\"\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u63d2\u56fe9\" \/><br \/> 3.&nbsp;\u2460\u5728\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u65f6\u5019\uff0c\u6211\u4eec\u4f7f\u7528app.json\u6587\u4ef6\u6765\u5bf9\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u8fdb\u884c\u5168\u5c40\u914d\u7f6e\uff0c\u51b3\u5b9a\u9875\u9762\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u7a97\u53e3\u8868\u73b0\uff0c\u8bbe\u7f6e\u7f51\u7edc\u8d85\u65f6\u65f6\u95f4\uff0c\u8bbe\u7f6e\u591aTab\u7b49\u3002&nbsp;<br \/> \u4ee5\u4e0b\u662f\u4e00\u4e2a\u5305\u542b\u4e86\u6240\u6709\u914d\u7f6e\u9009\u9879\u7684\u7b80\u5355\u914d\u7f6e\uff0capp.json \uff1a<\/p>\n<p><span style=\"color:#000000\"><\/span><\/p>\n<pre>{\n&nbsp;&nbsp;\/\/\u8bbe\u7f6e\u9875\u9762\u8def\u5f84\n&nbsp;&nbsp;\"pages\":&nbsp;[\n&nbsp;&nbsp;&nbsp;&nbsp;\"pages\/index\/index\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"pages\/logs\/index\"\n&nbsp;&nbsp;],\n&nbsp;&nbsp;\/\/\u8bbe\u7f6e\u9ed8\u8ba4\u9875\u9762\u7684\u7a97\u53e3\u8868\u73b0\n&nbsp;&nbsp;\"window\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"navigationBarTitleText\":&nbsp;\"Demo\"\n&nbsp;&nbsp;},\n&nbsp;&nbsp;\/\/\u8bbe\u7f6e\u5e95\u90e8&nbsp;tab&nbsp;\u7684\u8868\u73b0\n&nbsp;&nbsp;\"tabBar\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"list\":&nbsp;[{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"pagePath\":&nbsp;\"pages\/index\/index\",\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"text\":&nbsp;\"\u9996\u9875\"\n&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"pagePath\":&nbsp;\"pages\/logs\/logs\",\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"text\":&nbsp;\"\u65e5\u5fd7\"\n&nbsp;&nbsp;&nbsp;&nbsp;}]\n&nbsp;&nbsp;},\n&nbsp;&nbsp;\/\/\u8bbe\u7f6e\u7f51\u7edc\u8d85\u65f6\u65f6\u95f4\n&nbsp;&nbsp;\"networkTimeout\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"request\":&nbsp;10000,\n&nbsp;&nbsp;&nbsp;&nbsp;\"downloadFile\":&nbsp;10000\n&nbsp;&nbsp;},\n&nbsp;&nbsp;\/\/\u8bbe\u7f6e\u662f\u5426\u5f00\u542f&nbsp;debug&nbsp;\u6a21\u5f0f\n&nbsp;&nbsp;\"debug\":&nbsp;true\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u2461\u4f46\u662f\u5728\u5bf9\u9875\u9762json\u6587\u4ef6\u8fdb\u884c\u914d\u7f6e\u7684\u65f6\u5019\u53ea\u53ef\u4ee5\u914d\u7f6e\u8bbe\u7f6e\u9ed8\u8ba4\u9875\u9762\u7684\u7a97\u53e3\u8868\u73b0\uff08\u5373\u53ea\u80fd\u5bf9window\u8fdb\u884c\u914d\u7f6e\uff09\uff0c\u4f46\u662f\u5728\u6b64\u65f6\u53ef\u4ee5\u76f4\u63a5\u7701\u7565window\uff0c\u5982\u679c\u52a0window\u5219\u6ca1\u6709\u6548\u679c\uff0c\u4e5f\u4e0d\u4f1a\u62a5\u9519\u3002&nbsp;<br \/> \u4ee5\u4e0b\u662f\u4e00\u4e2a\u5305\u542b\u4e86window\u914d\u7f6e\u9009\u9879\u7684\u7b80\u5355\u914d\u7f6e\uff0cpost.json \uff1a<\/p>\n<p><strong>\u6ce8\u610f\uff1a\u8fd9\u662f\u9519\u8bef\u7684\u5199\u6cd5<\/strong><\/p>\n<p><span style=\"color:#000000\"><\/span><\/p>\n<pre>{\n&nbsp;&nbsp;\"window\":{\n&nbsp;&nbsp;&nbsp;&nbsp;\"navigationBarBackgroundColor\":&nbsp;\"#ffffff\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"navigationBarTextStyle\":&nbsp;\"black\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"navigationBarTitleText\":&nbsp;\"\u5fae\u4fe1\u63a5\u53e3\u529f\u80fd\u6f14\u793a\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"backgroundColor\":&nbsp;\"#eeeeee\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"backgroundTextStyle\":&nbsp;\"light\"\n&nbsp;&nbsp;}}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\uff1a\u6b63\u786e\u7684\u5199\u6cd5<\/strong><\/p>\n<p><span style=\"color:#000000\"><\/span><\/p>\n<pre>{\n&nbsp;&nbsp;&nbsp;&nbsp;\"navigationBarBackgroundColor\":&nbsp;\"#ffffff\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"navigationBarTextStyle\":&nbsp;\"black\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"navigationBarTitleText\":&nbsp;\"\u5fae\u4fe1\u63a5\u53e3\u529f\u80fd\u6f14\u793a\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"backgroundColor\":&nbsp;\"#eeeeee\",\n&nbsp;&nbsp;&nbsp;&nbsp;\"backgroundTextStyle\":&nbsp;\"light\"}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>4.\u6b64\u524d\u4e00\u76f4\u6ca1\u6709\u6ce8\u610fvertical-align: middle\u548cheight\uff1a40rpx;line-height:40rpx\u8fdb\u884c\u8bbe\u7f6e\u5782\u76f4\u5267\u4e2d\u7684\u533a\u522b\uff0c\u8fd9\u6b21\u4e3b\u8981\u8bf4\u4e00\u4e0bvertical-align: middle&nbsp;<br \/> \u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p><span style=\"color:#000000\"><\/span><\/p>\n<pre>&lt;view&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;image&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/image&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;text&gt;Nov&nbsp;15&nbsp;2016&lt;\/text&gt;&lt;\/view&gt;\n&nbsp;\n.post-author{\n&nbsp;&nbsp;&nbsp;&nbsp;width:&nbsp;60rpx;\n&nbsp;&nbsp;&nbsp;&nbsp;height:&nbsp;60rpx;\n&nbsp;&nbsp;&nbsp;&nbsp;vertical-align:&nbsp;middle;\n}\n.post-date{\n&nbsp;&nbsp;&nbsp;&nbsp;margin-top:&nbsp;5rpx;\n&nbsp;&nbsp;&nbsp;&nbsp;vertical-align:&nbsp;middle;\n&nbsp;&nbsp;&nbsp;&nbsp;\/*height:&nbsp;40rpx;\n&nbsp;&nbsp;&nbsp;&nbsp;line-height:&nbsp;40rpx;*\/\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u603b\u7ed3\uff1a&nbsp;<\/strong><br \/> \u2460vertical-align: middle;\u628a\u6b64\u5143\u7d20\u653e\u5728\u7236\u5143\u7d20\u7684\u4e2d\u90e8&nbsp;<br \/> \u2461\u5f53\u4e00\u4e2a\u7236\u5143\u7d20\u91cc\u9762\u6709\u591a\u4e2a\u5b50\u5143\u7d20\uff0c\u9700\u8981\u628a\u51e0\u4e2a\u5b50\u5143\u7d20\u6c34\u5e73\u5bf9\u9f50\uff0c\u5e76\u4e14\u6bcf\u4e2a\u5b50\u5143\u7d20\u90fd\u5782\u76f4\u5267\u4e2d\u7684\u65f6\u5019\uff0c\u5bf9\u6bcf\u4e00\u4e2a\u5b50\u5143\u7d20\u8fdb\u884c\u8bbe\u7f6e vertical-align: middle&nbsp;<br \/> \u2462height: 40rpx; line-height: 40rpx;\u53ef\u4ee5\u5bf9\u6587\u672c\u8fdb\u884c\u5782\u76f4\u5c45\u4e2d<\/p>\n<blockquote>\n<p><strong>\u76f8\u5173\u5b66\u4e60\u63a8\u8350\uff1a<\/strong><\/p>\n<\/blockquote>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6c47\u603b\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\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>\u5c0f\u7a0b\u5e8f\u9762\u8bd5\u9898 1\u3001bindtap\u548ccatchtap\u7684\u533a\u522b\u662f\u4ec0\u4e48\uff1f bind\u4e8b\u4ef6\u7ed1\u5b9a\u4e0d\u4f1a\u963b\u6b62\u5192\u6ce1\u4e8b\u4ef6\u5411\u4e0a\u5192\u6ce1\uff0ccatch\u4e8b\u4ef6\u7ed1\u5b9a\u53ef\u4ee5\u963b\u6b62\u5192\u6ce1\u4e8b\u4ef6\u5411\u4e0a\u5192\u6ce1 2\u3001Js\u6570\u7ec4\u8f6c\u6210\u6362\u5b57\u7b26\u4e32\uff0c\u5f3a\u5236\u8f6c\u6362\u6210\u6574\u6570\u53ca\u8f6c\u6362\u6210\u6d6e\u70b9\u6570\u7684\u51fd\u6570\u5206\u522b\u662f\u4ec0\u4e48\uff1f js\u63d0\u4f9b\u4e86parseInt()\u548cparseFloat()\u4e24\u4e2a\u8f6c\u6362\u51fd\u6570\u3002\u524d\u8005\u628a\u503c\u8f6c\u6362\u6210\u6574\u6570\uff0c\u540e\u8005\u628a\u503c\u8f6c\u6362\u6210\u6d6e\u70b9\u6570\u3002\u53ea\u6709\u5bf9String\u7c7b\u578b\u8c03\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u8fd9\u4e24\u4e2a\u51fd\u6570\u624d\u80fd\u6b63\u786e\u8fd0\u884c\uff1b\u5bf9\u5176\u4ed6\u7c7b\u578b\u8fd4\u56de\u7684\u90fd\u662fNaN(Not a Number)\u3002 \u76f8\u5173\u514d\u8d39\u5b66\u4e60\u63a8\u8350\uff1a 1\u3001\u8f6c\u6362\u51fd\u6570\uff1a \u5728 \u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u662f\u6570\u5b57\u503c\u524d\uff0cparseInt()\u548cparseFloat()\u90fd\u4f1a\u4ed4\u7ec6\u5206\u6790\u8be5\u5b57\u7b26\u4e32\u3002parseInt()\u65b9\u6cd5\u9996\u5148\u67e5\u770b\u4f4d\u7f6e0\u5904\u7684 \u5b57\u7b26\uff0c\u5224\u65ad\u5b83\u662f\u5426\u662f\u4e2a\u6709\u6548\u6570\u5b57\uff1b\u5982\u679c\u4e0d\u662f\uff0c\u8be5\u65b9\u6cd5\u5c06\u8fd4\u56deNaN\uff0c\u4e0d\u518d\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u64cd\u4f5c\u3002\u4f46\u5982\u679c\u8be5\u5b57\u7b26\u662f\u6709\u6548\u6570\u5b57\uff0c\u8be5\u65b9\u6cd5\u5c06\u67e5\u770b\u4f4d\u7f6e1\u5904\u7684\u5b57\u7b26\uff0c\u8fdb\u884c\u540c\u6837\u7684 \u6d4b\u8bd5\u3002\u8fd9\u4e00\u8fc7\u7a0b\u5c06\u6301\u7eed\u5230\u53d1\u73b0\u975e\u6709\u6548\u6570\u5b57\u7684\u5b57\u7b26\u4e3a\u6b62\uff0c\u6b64\u65f6parseInt()\u5c06\u628a\u8be5\u5b57\u7b26\u4e4b\u524d\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u6210\u6570\u5b57\u3002 parseInt(&#8220;1234blue&#8221;);&nbsp;\/\/returns&nbsp;1234&nbsp; parseInt(&#8220;0xA&#8221;);&nbsp;\/\/returns&nbsp;10&nbsp; parseInt(&#8220;22.5&#8221;);&nbsp;\/\/returns&nbsp;22&nbsp; parseInt(&#8220;blue&#8221;);&nbsp;\/\/returns&nbsp;NaN \u767b\u5f55\u540e\u590d\u5236 2. \u5f3a\u5236\u7c7b\u578b\u8f6c\u6362 \u8fd8\u53ef\u4f7f\u7528\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\uff08type casting\uff09\u5904\u7406\u8f6c\u6362\u503c\u7684\u7c7b\u578b\u3002\u4f7f\u7528\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u53ef\u4ee5\u8bbf\u95ee\u7279\u5b9a\u7684\u503c\uff0c\u5373\u4f7f\u5b83\u662f\u53e6\u4e00\u79cd\u7c7b\u578b\u7684\u3002ECMAScript\u4e2d\u53ef\u7528\u76843\u79cd\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u5982\u4e0b\uff1a&nbsp;Boolean(value)\u2014\u2014\u628a\u7ed9\u5b9a\u7684\u503c\u8f6c\u6362\u6210Boolean\u578b\uff1b&nbsp;Number(value)\u2014\u2014\u628a\u7ed9\u5b9a\u7684\u503c\u8f6c\u6362\u6210\u6570\u5b57\uff08\u53ef\u4ee5\u662f\u6574\u6570\u6216\u6d6e\u70b9\u6570\uff09\uff1b&nbsp;String(value)\u2014\u2014\u628a\u7ed9\u5b9a\u7684\u503c\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\u3002 3. \u5229\u7528js\u53d8\u91cf\u5f31\u7c7b\u578b\u8f6c\u6362 \u4e3e\u4e2a\u5c0f\u4f8b\u5b50\uff0c\u4e00\u770b\uff0c\u5c31\u4f1a\u660e\u767d\u4e86\u3002 &lt;script&gt; var str= &#039;012.345 &#039;; var x = str-0; x = x*1; &lt;\/script&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e0a\u4f8b\u5229\u7528\u4e86js\u7684\u5f31\u7c7b\u578b\u7684\u7279\u70b9\uff0c\u53ea\u8fdb\u884c\u4e86\u7b97\u672f\u8fd0\u7b97\uff0c\u5b9e\u73b0\u4e86\u5b57\u7b26\u4e32\u5230\u6570\u5b57\u7684\u7c7b\u578b\u8f6c\u6362\uff0c\u4e0d\u8fc7\u8fd9\u4e2a\u65b9\u6cd5\u8fd8\u662f\u4e0d\u63a8\u8350\u7684\u3002 3\u3001\u7b80\u5355\u63cf\u8ff0\u4e0b\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u76f8\u5173\u6587\u4ef6\u7c7b\u578b\u3002 \u5c0f\u7a0b\u5e8f\uff1apages \u2014\u2014index\uff1aindex.js(\u9875\u9762\u903b\u8f91) \/index.wxml (\u9875\u9762\u7ed3\u6784)\/index.wxss (\u9875\u9762\u6837\u5f0f\u8868) \/ index.json (\u9875\u9762\u914d\u7f6e) App.js &nbsp;&nbsp;\u5c0f\u7a0b\u5e8f\u903b\u8f91 App.json &nbsp;\u5c0f\u7a0b\u5e8f\u516c\u5171\u8bbe\u7f6e App.wxss &nbsp;&nbsp;\u5c0f\u7a0b\u5e8f\u516c\u5171\u6837\u5f0f\u8868 [&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-33955","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33955","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=33955"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33955\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}