{"id":166685,"date":"2024-05-08T15:42:29","date_gmt":"2024-05-08T07:42:29","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/166685.html"},"modified":"2024-05-08T15:42:36","modified_gmt":"2024-05-08T07:42:36","slug":"javascript%e9%a1%b9%e7%9b%ae%e4%b8%ad%e5%a6%82%e4%bd%95%e5%b0%86%e5%90%8c%e6%ad%a5%e7%9a%84%e5%87%bd%e6%95%b0%e5%b9%b3%e6%bb%91%e5%88%87%e6%8d%a2%e5%88%b0%e5%bc%82%e6%ad%a5%e7%9a%84%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/166685.html","title":{"rendered":"javascript\u9879\u76ee\u4e2d\u5982\u4f55\u5c06\u540c\u6b65\u7684\u51fd\u6570\u5e73\u6ed1\u5207\u6362\u5230\u5f02\u6b65\u7684\u51fd\u6570"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/26233737\/1b00dea6-6476-4620-8be8-9c2316e7ceb5.webp\" alt=\"javascript\u9879\u76ee\u4e2d\u5982\u4f55\u5c06\u540c\u6b65\u7684\u51fd\u6570\u5e73\u6ed1\u5207\u6362\u5230\u5f02\u6b65\u7684\u51fd\u6570\" \/><\/p>\n<p><p>\u5c06\u540c\u6b65\u51fd\u6570\u5e73\u6ed1\u5207\u6362\u5230\u5f02\u6b65\u51fd\u6570\u4e3b\u8981\u6709\u51e0\u4e2a\u5173\u952e\u6b65\u9aa4\uff1a<strong>\u4f7f\u7528Promise\u5c01\u88c5\u3001\u5229\u7528async\/aw<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>t\u8bed\u6cd5\u7cd6\u3001\u8fdb\u884c\u91cd\u6784\u4e0e\u6d4b\u8bd5\u3001\u4ee5\u53ca\u5229\u7528JavaScript\u8fd0\u884c\u65f6\u73af\u5883\u7684\u7279\u6027<\/strong>\u3002\u8fd9\u4e9b\u6b65\u9aa4\u5171\u540c\u4fdd\u8bc1\u4e86\u4ee3\u7801\u4ece\u540c\u6b65\u5230\u5f02\u6b65\u7684\u5e73\u7a33\u8fc7\u6e21\uff0c\u540c\u65f6\u7ef4\u6301\u6216\u63d0\u5347\u4e86\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u6027\u80fd\u3002<strong>\u6700\u4e3a\u5173\u952e\u7684\u6b65\u9aa4\u662f\u5229\u7528async\/await\u8bed\u6cd5\u7cd6<\/strong>\uff0c\u56e0\u4e3a\u5b83\u4e0d\u4ec5\u7b80\u5316\u4e86\u5f02\u6b65\u64cd\u4f5c\u7684\u5199\u6cd5\uff0c\u4f7f\u4ee3\u7801\u66f4\u6613\u8bfb\u3001\u6613\u7ef4\u62a4\uff0c\u800c\u4e14\u5728\u903b\u8f91\u5904\u7406\u8fc7\u7a0b\u4e2d\uff0c\u80fd\u591f\u8ba9\u5f00\u53d1\u8005\u4ee5\u540c\u6b65\u7684\u65b9\u5f0f\u7f16\u5199\u5f02\u6b65\u4ee3\u7801\uff0c\u6781\u5927\u7b80\u5316\u4e86\u4ee3\u7801\u7684\u590d\u6742\u5ea6\u3002\u6211\u4eec\u5c06\u4ee5\u6b64\u4e3a\u91cd\u70b9\uff0c\u6df1\u5165\u63a2\u8ba8\u5982\u4f55\u9ad8\u6548\u5730\u5c06\u540c\u6b65\u51fd\u6570\u8f6c\u5316\u4e3a\u5f02\u6b65\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u7406\u89e3\u540c\u6b65\u4e0e\u5f02\u6b65\u7684\u57fa\u672c\u6982\u5ff5<\/h3>\n<\/p>\n<p><p>\u540c\u6b65\u548c\u5f02\u6b65\u662f\u7f16\u7a0b\u4e2d\u63cf\u8ff0\u51fd\u6570\u8c03\u7528\u884c\u4e3a\u7684\u4e24\u79cd\u65b9\u5f0f\u3002\u540c\u6b65\u8c03\u7528\u610f\u5473\u7740\u4ee3\u7801\u7684\u6267\u884c\u5fc5\u987b\u7b49\u5f85\u8c03\u7528\u7684\u51fd\u6570\u5b8c\u6210\u540e\u624d\u80fd\u7ee7\u7eed\u5411\u4e0b\u6267\u884c\u3002\u800c\u5f02\u6b65\u8c03\u7528\u5219\u5141\u8bb8\u4ee3\u7801\u5728\u7b49\u5f85\u67d0\u4e2a\u4efb\u52a1\u5b8c\u6210\u65f6\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u4efb\u52a1\uff0c\u4e0d\u5fc5\u963b\u585e\u540e\u7eed\u4ee3\u7801\u7684\u6267\u884c\u3002<\/p>\n<\/p>\n<p><p>\u5728\u6df1\u5165\u8ba8\u8bba\u5982\u4f55\u8f6c\u6362\u4e4b\u524d\uff0c\u8ba4\u8bc6\u5230\u540c\u6b65\u548c\u5f02\u6b65\u5904\u7406\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u4e0d\u540c\u7528\u9014\u548c\u5f71\u54cd\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u540c\u6b65\u8c03\u7528\u901a\u5e38\u7b80\u5355\u76f4\u63a5\uff0c\u6613\u4e8e\u7406\u89e3\u548c\u7ef4\u62a4\uff0c\u4f46\u5728\u5904\u7406\u8017\u65f6\u4efb\u52a1\u65f6\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u7684\u54cd\u5e94\u6027\u80fd\u4e0b\u964d\u3002\u76f8\u53cd\uff0c\u5f02\u6b65\u8c03\u7528\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6548\u7387\u548c\u54cd\u5e94\u80fd\u529b\uff0c\u7279\u522b\u662f\u5728\u6d89\u53caI\/O\u64cd\u4f5c\uff08\u5982\u7f51\u7edc\u8bf7\u6c42\u3001\u6587\u4ef6\u8bfb\u53d6\u7b49\uff09\u65f6\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528Promise\u5c01\u88c5\u540c\u6b65\u51fd\u6570<\/h3>\n<\/p>\n<p><p>Promise\u662fJavaScript\u4e2d\u7528\u4e8e\u5904\u7406\u5f02\u6b65\u64cd\u4f5c\u7684\u5173\u952e\u6982\u5ff5\u4e4b\u4e00\u3002\u901a\u8fc7Promise\uff0c\u53ef\u4ee5\u5c06\u539f\u672c\u7684\u540c\u6b65\u51fd\u6570\u5305\u88c5\u4e3a\u5f02\u6b65\u51fd\u6570\uff0c\u4f7f\u5176\u53ef\u4ee5\u5728\u672a\u6765\u7684\u67d0\u4e2a\u65f6\u523b\u8fd4\u56de\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u7acb\u5373\u8fd4\u56de\u3002<\/p>\n<\/p>\n<p><p>\u8981\u5c06\u540c\u6b65\u51fd\u6570\u8f6c\u5316\u4e3a\u5f02\u6b65\u51fd\u6570\uff0c\u9996\u5148\u9700\u8981\u521b\u5efa\u4e00\u4e2aPromise\u5bf9\u8c61\uff0c\u5e76\u5728Promise\u7684\u6267\u884c\u5668\u51fd\u6570\u4e2d\u8c03\u7528\u539f\u540c\u6b65\u51fd\u6570\u3002\u5982\u679c\u540c\u6b65\u51fd\u6570\u6267\u884c\u6210\u529f\uff0c\u5728\u6267\u884c\u5668\u51fd\u6570\u4e2d\u8c03\u7528<code>resolve<\/code>\u65b9\u6cd5\u5e76\u4f20\u9012\u7ed3\u679c\uff1b\u5982\u679c\u6267\u884c\u5931\u8d25\uff0c\u5219\u8c03\u7528<code>reject<\/code>\u65b9\u6cd5\u5e76\u4f20\u9012\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-javascript\">function syncFunction() {<\/p>\n<p>  \/\/ \u5047\u8bbe\u8fd9\u662f\u4e00\u4e2a\u8017\u65f6\u7684\u540c\u6b65\u64cd\u4f5c<\/p>\n<p>  return &quot;\u540c\u6b65\u64cd\u4f5c\u7684\u7ed3\u679c&quot;;<\/p>\n<p>}<\/p>\n<p>function asyncFunction() {<\/p>\n<p>  return new Promise((resolve, reject) =&gt; {<\/p>\n<p>    try {<\/p>\n<p>      const result = syncFunction();<\/p>\n<p>      resolve(result);<\/p>\n<p>    } catch (error) {<\/p>\n<p>      reject(error);<\/p>\n<p>    }<\/p>\n<p>  });<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u6ca1\u6709\u6539\u53d8\u539f\u59cb\u540c\u6b65\u51fd\u6570\u7684\u5185\u90e8\u903b\u8f91\uff0c\u53ea\u662f\u5c06\u5176\u5305\u88c5\u5728Promise\u4e2d\uff0c\u4f7f\u5176\u80fd\u4ee5\u5f02\u6b65\u65b9\u5f0f\u88ab\u8c03\u7528\u548c\u5904\u7406\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5229\u7528async\/await\u8bed\u6cd5\u7cd6<\/h3>\n<\/p>\n<p><p><code>async\/await<\/code>\u662f\u5728ES2017\u4e2d\u5f15\u5165\u7684\uff0c\u76ee\u7684\u662f\u7b80\u5316\u4f7f\u7528Promise\u7684\u5f02\u6b65\u64cd\u4f5c\u3002\u901a\u8fc7\u8fd9\u4e24\u4e2a\u5173\u952e\u5b57\uff0c\u53ef\u4ee5\u7528\u66f4\u63a5\u8fd1\u540c\u6b65\u4ee3\u7801\u7684\u65b9\u5f0f\u6765\u7f16\u5199\u5f02\u6b65\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><p>\u5c06\u51fd\u6570\u6807\u8bb0\u4e3a<code>async<\/code>\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u8be5\u51fd\u6570\u5185\u90e8\u4f7f\u7528<code>await<\/code>\u5173\u952e\u5b57\u3002<code>await<\/code>\u5173\u952e\u5b57\u53ef\u4ee5\u6682\u505casync\u51fd\u6570\u7684\u6267\u884c\uff0c\u7b49\u5f85Promise\u7684\u89e3\u51b3\uff0c\u5e76\u7ee7\u7eed\u6267\u884casync\u51fd\u6570\u4e4b\u540e\u7684\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-javascript\">async function asyncFunctionExample() {<\/p>\n<p>  try {<\/p>\n<p>    const result = await asyncFunction();<\/p>\n<p>    console.log(result); \/\/ \u6253\u5370\u51fa\u4e4b\u524d\u540c\u6b65\u64cd\u4f5c\u7684\u7ed3\u679c\uff0c\u4f46\u4ee5\u5f02\u6b65\u65b9\u5f0f\u5904\u7406<\/p>\n<p>  } catch (error) {<\/p>\n<p>    console.error(error);<\/p>\n<p>  }<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7<code>async\/await<\/code>\uff0c\u6211\u4eec\u53ef\u4ee5\u51cf\u5c11Promise\u94fe\u7684\u4f7f\u7528\uff0c\u8ba9\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u6613\u8bfb\u3002\u8fd9\u5bf9\u4e8e\u5c06\u540c\u6b65\u529f\u80fd\u5e73\u6ed1\u5730\u8f6c\u6362\u4e3a\u5f02\u6b65\u5c24\u4e3a\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u66f4\u76f4\u89c2\u7684\u5904\u7406\u5f02\u6b65\u903b\u8f91\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u8fdb\u884c\u91cd\u6784\u4e0e\u6d4b\u8bd5<\/h3>\n<\/p>\n<p><p>\u5728\u5c06\u540c\u6b65\u51fd\u6570\u8f6c\u6362\u4e3a\u5f02\u6b65\u51fd\u6570\u7684\u8fc7\u7a0b\u4e2d\uff0c\u91cd\u6784\u548c\u6d4b\u8bd5\u662f\u4e0d\u53ef\u6216\u7f3a\u7684\u73af\u8282\uff0c\u786e\u4fdd\u4ee3\u7801\u7684\u53ef\u9760\u6027\u548c\u7a33\u5b9a\u6027\u6ca1\u6709\u53d7\u5230\u5f71\u54cd\u3002\u91cd\u6784\u9700\u8981\u5ba1\u614e\u8fdb\u884c\uff0c\u786e\u4fdd\u6bcf\u4e00\u6b65\u8f6c\u6362\u90fd\u4e0d\u4f1a\u5f15\u5165\u65b0\u7684\u9519\u8bef\u6216\u964d\u4f4e\u4ee3\u7801\u8d28\u91cf\u3002<\/p>\n<\/p>\n<p><p>\u5355\u5143\u6d4b\u8bd5\u548c\u96c6\u6210\u6d4b\u8bd5\u5728\u8fd9\u4e00\u8fc7\u7a0b\u4e2d\u53d1\u6325\u7740\u5173\u952e\u4f5c\u7528\uff0c\u5b83\u4eec\u53ef\u4ee5\u786e\u4fdd\u6211\u4eec\u5bf9\u540c\u6b65\u51fd\u6570\u7684\u6bcf\u6b21\u4fee\u6539\u540e\u7684\u5f02\u6b65\u7248\u672c\u884c\u4e3a\u4ecd\u7136\u7b26\u5408\u9884\u671f\u3002\u5bf9\u5f02\u6b65\u51fd\u6570\u7684\u6d4b\u8bd5\uff0c\u7279\u522b\u8981\u6ce8\u610f\u6d4b\u8bd5\u6848\u4f8b\u662f\u5426\u80fd\u591f\u6b63\u786e\u5904\u7406\u5f02\u6b65\u903b\u8f91\uff0c\u6bd4\u5982\u4f7f\u7528<code>async\/await<\/code>\u6765\u7b49\u5f85\u5f02\u6b65\u64cd\u4f5c\u5b8c\u6210\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5229\u7528JavaScript\u8fd0\u884c\u65f6\u73af\u5883\u7684\u7279\u6027<\/h3>\n<\/p>\n<p><p>JavaScript\u7684\u8fd0\u884c\u65f6\u73af\u5883\uff0c\u5982Node.js\u6216\u6d4f\u89c8\u5668\uff0c\u63d0\u4f9b\u4e86\u8bb8\u591a\u5185\u7f6e\u7684API\u548c\u5de5\u5177\uff0c\u4ee5\u652f\u6301\u5f02\u6b65\u7f16\u7a0b\u3002\u4e86\u89e3\u548c\u5229\u7528\u8fd9\u4e9b\u73af\u5883\u6240\u63d0\u4f9b\u7684\u7279\u6027\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u66f4\u9ad8\u6548\u5730\u5b9e\u73b0\u540c\u6b65\u5230\u5f02\u6b65\u7684\u8f6c\u6362\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u5728Node.js\u4e2d\uff0c\u5927\u90e8\u5206\u5185\u7f6e\u6a21\u5757\u90fd\u63d0\u4f9b\u4e86\u5f02\u6b65\u7248\u672c\u7684API\uff0c\u5b83\u4eec\u8fd4\u56dePromise\u5bf9\u8c61\uff0c\u53ef\u4ee5\u76f4\u63a5\u4e0e<code>async\/await<\/code>\u914d\u5408\u4f7f\u7528\u3002\u800c\u5728\u524d\u7aef\u5f00\u53d1\u4e2d\uff0c\u6d4f\u89c8\u5668\u7684Web API\uff08\u5982<code>fetch<\/code>\u7528\u4e8e\u7f51\u7edc\u8bf7\u6c42\uff09\u4e5f\u662f\u57fa\u4e8ePromise\u8bbe\u8ba1\u7684\uff0c\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5f02\u6b65\u652f\u6301\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u7efc\u5408\u8fd0\u7528\u4e0a\u8ff0\u6280\u672f\u548c\u65b9\u6cd5\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u5b9e\u73b0\u5c06\u9879\u76ee\u4e2d\u7684\u540c\u6b65\u51fd\u6570\u5e73\u6ed1\u5207\u6362\u5230\u5f02\u6b65\u51fd\u6570\uff0c\u4e0d\u4ec5\u4f18\u5316\u4e86\u5e94\u7528\u7684\u6027\u80fd\u548c\u54cd\u5e94\u80fd\u529b\uff0c\u8fd8\u63d0\u5347\u4e86\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u7ef4\u62a4\u6027\u3002\u8fd9\u4e00\u8fc7\u7a0b\u867d\u7136\u53ef\u80fd\u6d89\u53ca\u6df1\u5165\u7684\u4ee3\u7801\u91cd\u6784\uff0c\u4f46\u6700\u7ec8\u4e3a\u9879\u76ee\u5e26\u6765\u7684\u597d\u5904\u662f\u663e\u800c\u6613\u89c1\u7684\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u5982\u4f55\u5728Javascript\u9879\u76ee\u4e2d\u5c06\u540c\u6b65\u51fd\u6570\u8f6c\u6362\u4e3a\u5f02\u6b65\u51fd\u6570\uff1f<\/strong><\/p>\n<ul>\n<li>\u4e3a\u4e86\u5c06\u540c\u6b65\u51fd\u6570\u5e73\u6ed1\u5207\u6362\u5230\u5f02\u6b65\u51fd\u6570\uff0c\u53ef\u4ee5\u4f7f\u7528Javascript\u4e2d\u7684Promise\u5bf9\u8c61\u3002\u9996\u5148\uff0c\u5c06\u540c\u6b65\u51fd\u6570\u5305\u88c5\u5728\u4e00\u4e2aPromise\u5bf9\u8c61\u4e2d\uff0c\u7136\u540e\u4f7f\u7528\u5f02\u6b65\u64cd\u4f5c\u6765\u5904\u7406\u51fd\u6570\u5185\u7684\u8017\u65f6\u4efb\u52a1\u3002\u53ef\u4ee5\u4f7f\u7528setTimeout\u51fd\u6570\u6765\u6a21\u62df\u5f02\u6b65\u64cd\u4f5c\u7684\u5ef6\u8fdf\u65f6\u95f4\u3002\u5728\u4efb\u52a1\u5b8c\u6210\u540e\uff0c\u4f7f\u7528resolve\u65b9\u6cd5\u5c06\u7ed3\u679c\u4f20\u9012\u7ed9Promise\u5bf9\u8c61\uff0c\u5e76\u5728\u9700\u8981\u7684\u5730\u65b9\u901a\u8fc7then\u65b9\u6cd5\u6765\u5904\u7406\u5f02\u6b65\u64cd\u4f5c\u7684\u7ed3\u679c\u3002<\/li>\n<\/ul>\n<p><strong>\u6709\u54ea\u4e9b\u5e38\u7528\u7684\u6280\u672f\u53ef\u4ee5\u5c06\u540c\u6b65\u51fd\u6570\u8f6c\u6362\u4e3a\u5f02\u6b65\u51fd\u6570\uff1f<\/strong><\/p>\n<ul>\n<li>\u5728Javascript\u4e2d\uff0c\u6709\u591a\u79cd\u5e38\u7528\u7684\u6280\u672f\u53ef\u4ee5\u5c06\u540c\u6b65\u51fd\u6570\u8f6c\u6362\u4e3a\u5f02\u6b65\u51fd\u6570\u3002\u5176\u4e2d\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u56de\u8c03\u51fd\u6570\uff08callback\uff09\u3002\u901a\u8fc7\u5c06\u5f02\u6b65\u64cd\u4f5c\u5c01\u88c5\u5728\u4e00\u4e2a\u51fd\u6570\u5185\uff0c\u5e76\u5c06\u56de\u8c03\u51fd\u6570\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u7ed9\u8fd9\u4e2a\u51fd\u6570\uff0c\u5728\u5f02\u6b65\u64cd\u4f5c\u5b8c\u6210\u540e\uff0c\u8c03\u7528\u56de\u8c03\u51fd\u6570\u5e76\u5c06\u7ed3\u679c\u4f20\u9012\u7ed9\u5b83\u3002\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u4f7f\u7528Promise\u5bf9\u8c61\uff0c\u901a\u8fc7\u5728\u540c\u6b65\u51fd\u6570\u4e2d\u8fd4\u56de\u4e00\u4e2aPromise\u5bf9\u8c61\u5e76\u5728\u5f02\u6b65\u64cd\u4f5c\u5b8c\u6210\u540e\u8c03\u7528resolve\u65b9\u6cd5\u6765\u5904\u7406\u7ed3\u679c\u3002<\/li>\n<\/ul>\n<p><strong>\u4e3a\u4f55\u8981\u5c06\u540c\u6b65\u51fd\u6570\u8f6c\u6362\u4e3a\u5f02\u6b65\u51fd\u6570\uff1f<\/strong><\/p>\n<ul>\n<li>\u5c06\u540c\u6b65\u51fd\u6570\u8f6c\u6362\u4e3a\u5f02\u6b65\u51fd\u6570\u7684\u4e00\u4e2a\u4e3b\u8981\u539f\u56e0\u662f\u4e3a\u4e86\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u548c\u7528\u6237\u4f53\u9a8c\u3002\u5728Javascript\u4e2d\uff0c\u540c\u6b65\u51fd\u6570\u4f1a\u963b\u585e\u6267\u884c\u7ebf\u7a0b\uff0c\u8fd9\u610f\u5473\u7740\u5f53\u540c\u6b65\u51fd\u6570\u6267\u884c\u65f6\uff0c\u5e94\u7528\u7a0b\u5e8f\u65e0\u6cd5\u54cd\u5e94\u5176\u4ed6\u7684\u7528\u6237\u4ea4\u4e92\u6216\u8005\u6267\u884c\u5176\u4ed6\u7684\u4efb\u52a1\u3002\u800c\u5c06\u51fd\u6570\u8f6c\u6362\u4e3a\u5f02\u6b65\u51fd\u6570\uff0c\u53ef\u4ee5\u4f7f\u5e94\u7528\u7a0b\u5e8f\u5728\u6267\u884c\u5f02\u6b65\u64cd\u4f5c\u65f6\uff0c\u4fdd\u6301\u54cd\u5e94\u6027\uff0c\u540c\u65f6\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u3002\u53e6\u5916\uff0c\u5f02\u6b65\u51fd\u6570\u53ef\u4ee5\u66f4\u597d\u5730\u5904\u7406\u8017\u65f6\u4efb\u52a1\u3002\u901a\u8fc7\u5c06\u8fd9\u4e9b\u4efb\u52a1\u653e\u5165\u540e\u53f0\u7ebf\u7a0b\u6216\u8005\u4f7f\u7528\u975e\u963b\u585e\u7684\u65b9\u5f0f\u6267\u884c\uff0c\u53ef\u4ee5\u907f\u514d\u963b\u585e\u4e3b\u7ebf\u7a0b\uff0c\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u7684\u6548\u7387\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"\u5c06\u540c\u6b65\u51fd\u6570\u5e73\u6ed1\u5207\u6362\u5230\u5f02\u6b65\u51fd\u6570\u4e3b\u8981\u6709\u51e0\u4e2a\u5173\u952e\u6b65\u9aa4\uff1a\u4f7f\u7528Promise\u5c01\u88c5\u3001\u5229\u7528async\/awAIt\u8bed\u6cd5\u7cd6\u3001\u8fdb\u884c [&hellip;]","protected":false},"author":3,"featured_media":166695,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/166685"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=166685"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/166685\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/166695"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=166685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=166685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=166685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}