{"id":3497,"date":"2020-06-25T23:26:55","date_gmt":"2020-06-25T15:26:55","guid":{"rendered":"http:\/\/www.ponybai.com\/?p=2421"},"modified":"2020-06-25T23:26:55","modified_gmt":"2020-06-25T15:26:55","slug":"salesforce%e5%bc%80%e5%8f%91%e4%ba%ba%e5%91%98%e7%9a%84javascript%e6%8a%80%e8%83%bd-%e5%af%b9%e4%ba%8b%e4%bb%b6%e5%92%8c%e5%8a%9f%e8%83%bd%e9%87%87%e5%8f%96%e8%a1%8c%e5%8a%a8","status":"publish","type":"post","link":"http:\/\/www.ponybai.com\/?p=3497","title":{"rendered":"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8"},"content":{"rendered":"\n\t\t\t\t\n<h2 class=\"wp-block-heading\">\u5b66\u4e60\u76ee\u6807<\/h2>\n\n\n\n<p>\u5b8c\u6210\u672c\u5355\u5143\u540e\uff0c\u60a8\u5c06\u80fd\u591f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5b9a\u4e49\u529f\u80fd<\/li><li>\u533a\u5206\u51fd\u6570\u58f0\u660e\u548c\u51fd\u6570\u8868\u8fbe\u5f0f<\/li><li>\u8c03\u7528\u529f\u80fd<\/li><li>\u4f20\u9012\u548c\u5206\u914d\u529f\u80fd<\/li><li>\u63cf\u8ff0\u95ea\u7535\u7f51\u7edc\u7ec4\u4ef6\u4e2d\u529f\u80fd\u548c\u4e8b\u4ef6\u7684\u4f7f\u7528<\/li><\/ul>\n\n\n\n<p>\u5f53\u8981\u4f7f\u4e8b\u60c5\u53d1\u751f\u5728JavaScript\u4e2d\u65f6\uff0c\u4e00\u5207\u90fd\u4e0e\u4e8b\u4ef6\u548c\u51fd\u6570\u6709\u5173\u3002<\/p>\n\n\n\n<p>\u8fd8\u8bb0\u5f97\u6211\u4eec\u7684\u8fd0\u884c\u65f6\u6a21\u578b\u5417\uff1f\u8ba9\u6211\u4eec\u6269\u5c55\u4e00\u4e0b\u3002&nbsp;<\/p>\n\n\n\n<p>\u4f7f\u7528\u6d4f\u89c8\u5668\u4e2d\u7684JavaScript\uff0c\u4e8b\u4ef6\u65e0\u5904\u4e0d\u5728\u3002DOM\u7684\u67d0\u4e9b\u90e8\u5206\u53d1\u51fa\u7684\u4e8b\u4ef6\u4e0e\u8be5DOM\u5bf9\u8c61\u7684\u884c\u4e3a\u76f8\u5bf9\u5e94\u3002\u6309\u94ae\u5177\u6709\u5355\u51fb\u4e8b\u4ef6\uff0c\u8f93\u5165\u548c\u9009\u62e9\u63a7\u4ef6\u5177\u6709\u66f4\u6539\u4e8b\u4ef6\uff0c\u5e76\u4e14\u53ef\u89c1DOM\u7684\u51e0\u4e4e\u6bcf\u4e2a\u90e8\u5206\u5b9e\u9645\u4e0a\u90fd\u5177\u6709\u9f20\u6807\u5149\u6807\u4e0e\u5176\u4ea4\u4e92\uff08\u4f8b\u5982\uff0c\u7ecf\u8fc7\u5b83\uff09\u7684\u4e8b\u4ef6\u3002\u7a97\u53e3\u5bf9\u8c61\u751a\u81f3\u5177\u6709\u7528\u4e8e\u5904\u7406\u8bbe\u5907\u4e8b\u4ef6\u7684\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\uff08\u4f8b\u5982\u68c0\u6d4b\u79fb\u52a8\u8bbe\u5907\u7684\u8fd0\u52a8\uff09\u3002&nbsp;<\/p>\n\n\n\n<p>\u4e3a\u4e86\u4f7f\u67d0\u4ef6\u4e8b\u53d1\u751f\u5728\u7f51\u9875\u4e2d\uff0c\u5c06\u51fd\u6570\u5206\u914d\u7ed9\u8fd9\u4e9b\u4e8b\u4ef6\u4f5c\u4e3a\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u3002&nbsp;<\/p>\n\n\n\n<p>\u91cd\u7533\u4e00\u4e0b\uff0cDOM\u4e8b\u4ef6\u548c\u4e0e\u6d4f\u89c8\u5668\u73af\u5883\u76f8\u5173\u7684\u5176\u4ed6\u4e8b\u4ef6\u5b9e\u9645\u4e0a\u5e76\u4e0d\u662f\u6838\u5fc3JavaScript\u8bed\u8a00\u7684\u4e00\u90e8\u5206\uff0c\u800c\u662f\u5b83\u4eec\u662f\u5728\u6d4f\u89c8\u5668\u4e2d\u4e3aJavaScript\u5b9e\u73b0\u7684API\u3002&nbsp;<\/p>\n\n\n\n<p>\u53d1\u51fa\u4e8b\u4ef6\u65f6\uff0c\u5c06\u5728\u5f15\u64ce\u4e2d\u521b\u5efa\u4e00\u6761\u6d88\u606f\u3002\u8fd9\u4e9b\u6d88\u606f\u88ab\u653e\u7f6e\u5728\u6211\u4eec\u524d\u9762\u8ba8\u8bba\u7684\u4e8b\u4ef6\u961f\u5217\u4e2d\u3002&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/hy4kyit2a\/f_auto,fl_lossy,q_70\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions\/images\/4999e793b0432e8c4e10e440784ca5f5_cjksehj-0-s-000-w-0-t-6-rvvlpiln-9.png\" alt=\"\u961f\u5217\u4e2d\u7684\u6d88\u606f\u548c\u5806\u6808\u4e2d\u7684\u5e27\u3002\"\/><\/figure>\n\n\n\n<p>\u91ca\u653e\u5806\u6808\u540e\uff0c\u5c06\u8c03\u7528\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u3002\u8fd9\u5c06\u5728\u8c03\u7528\u5806\u6808\u4e0a\u521b\u5efa\u6240\u8c13\u7684\u6846\u67b6\u3002\u6bcf\u6b21\u4e00\u4e2a\u51fd\u6570\u8c03\u7528\u53e6\u4e00\u4e2a\u51fd\u6570\u65f6\uff0c\u90fd\u4f1a\u5c06\u4e00\u4e2a\u65b0\u6846\u67b6\u6dfb\u52a0\u5230\u5806\u6808\u4e2d\uff0c\u5b8c\u6210\u540e\u4f1a\u4ece\u5806\u6808\u4e2d\u5f39\u51fa\uff0c\u76f4\u5230\u6700\u540e\u5f39\u51fa\u5b9e\u9645\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u7684\u6846\u67b6\uff0c\u5806\u6808\u4e3a\u7a7a\uff0c\u7136\u540e\u6211\u4eec\u91cd\u65b0\u5f00\u59cb\u3002&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions#-----------defining-and-assigning-functions--\"><\/a>\u5b9a\u4e49\u548c\u5206\u914d\u529f\u80fd<\/h2>\n\n\n\n<p>\u5728JavaScript\u4e2d\uff0c\u51fd\u6570\u672c\u8d28\u4e0a\u662f\u7279\u6b8a\u7684\u5bf9\u8c61\u3002\u4f5c\u4e3a\u5bf9\u8c61\uff0c\u5b83\u4eec\u662fJavaScript\u7684\u4e00\u6d41\u6210\u5458\u3002\u53ef\u4ee5\u5c06\u5b83\u4eec\u5206\u914d\u4e3a\u53d8\u91cf\u7684\u503c\uff0c\u5c06\u5176\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u7ed9\u5176\u4ed6\u51fd\u6570\uff0c\u7136\u540e\u4ece\u51fd\u6570\u4e2d\u8fd4\u56de\u3002&nbsp;<\/p>\n\n\n\n<p>\u51fd\u6570\u751f\u547d\u5468\u671f\u6709\u4e24\u4e2a\u57fa\u672c\u9636\u6bb5\uff1a\u5b9a\u4e49\u548c\u8c03\u7528\u3002 &nbsp;<\/p>\n\n\n\n<p>\u58f0\u660e\u51fd\u6570\u65f6\uff0c\u5176\u5b9a\u4e49\u5c06\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\u3002\u7136\u540e\u4ee5\u53d8\u91cf\u540d\uff0c\u53c2\u6570\u540d\u6216\u5bf9\u8c61\u5c5e\u6027\u7684\u5f62\u5f0f\u5c06\u6307\u9488\u5206\u914d\u7ed9\u5b83\u3002\u4f46\u662f\uff0c\u6709\u51e0\u79cd\u4e0d\u540c\u7684\u8bed\u6cd5\u53ef\u4ee5\u505a\u5230\u8fd9\u4e00\u70b9\u4e5f\u5c31\u4e0d\u8db3\u4e3a\u5947\u4e86\u3002<\/p>\n\n\n\n<p><strong>\u529f\u80fd\u58f0\u660e<\/strong><\/p>\n\n\n\n<p>\u58f0\u660e\u662f\u4f7f\u7528<code>function<\/code>\u5173\u952e\u5b57\u521b\u5efa\u51fd\u6570\u7684\u8bed\u53e5\u3002\u5b9e\u9645\u4e0a\uff0c\u5f53\u6211\u4eec\u67e5\u770b\u5bf9\u8c61\u6784\u9020\u51fd\u6570\u65f6\uff0c\u6211\u4eec\u5df2\u7ecf\u770b\u5230\u4e86\u5b83\u3002\u8be5\u6784\u9020\u51fd\u6570\u662f\u4e00\u4e2a\u51fd\u6570\u3002\u4f46\u662f\u6784\u9020\u51fd\u6570\u6709\u70b9\u7279\u6b8a\uff0c\u6240\u4ee5\u8ba9\u6211\u4eec\u9000\u4e00\u6b65\uff0c\u8c08\u8bba\u666e\u901a\u7684\u65e7\u51fd\u6570\uff0c\u770b\u770b\u5b83\u4eec\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1a&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ declare function\nfunction calculateGearRatio(driverGear, drivenGear){\n  return (driverGear \/ drivenGear);\n}\n\/\/ call function\nlet gearRatio = calculateGearRatio(42, 30);\nconsole.log(gearRatio); \/\/ 1.4<\/code><\/pre>\n\n\n\n<p>\u5728\u6b64\u4ee3\u7801\u793a\u4f8b\u4e2d\uff0c\u51fd\u6570\u540e\u8ddf\u51fd\u6570\u540d\u79f0\uff0c\u5e76\u5728\u62ec\u53f7\u4e2d\u5305\u542b\u53c2\u6570\u3002&nbsp;<\/p>\n\n\n\n<p>\u8fd9\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\uff0c\u4f46\u662f\u6709\u4e00\u4e9b\u9690\u5f0f\u4e8b\u4ef6\u6b63\u5728\u53d1\u751f\u3002\u9996\u5148\uff0c\u51fd\u6570\u540d\u79f0\u6210\u4e3a\u53d8\u91cf\u540d\u79f0\u3002\u5b83\u8fd8\u5c06\u53d8\u91cf\u9690\u5f0f\u5206\u914d\u7ed9\u5c01\u95ed\u7684\u4e0a\u4e0b\u6587\u3002\u6700\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u58f0\u660e\u6b64\u51fd\u6570\u4e4b\u524d\u8c03\u7528\u5b83\uff0c\u4f8b\u5982\u5728\u58f0\u660e\u4e0b\u9762<code>calculateGearRatio<\/code>\u7684\u90a3\u4e00\u884c\u8c03\u7528\u4e0b\u9762\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ call function\nlet gearRatio = calculateGearRatio(42, 30);\n\/\/ function is declared after the line it is called\n\/\/ this is allowed in function declaration\nfunction calculateGearRatio(driverGear, drivenGear){\n  return (driverGear \/ drivenGear);\n}\nconsole.log(gearRatio); \/\/ 1.4<\/code><\/pre>\n\n\n\n<p><strong>\u51fd\u6570\u8868\u8fbe\u5f0f<\/strong><\/p>\n\n\n\n<p>\u51fd\u6570\u8868\u8fbe\u5f0f\u66f4\u660e\u786e\u5730\u5b9e\u73b0\u4e86\u4e0e\u58f0\u660e\u76f8\u540c\u7684\u529f\u80fd\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const calculateGearRatio = function(driverGear, drivenGear){\n  return (driverGear \/ drivenGear);\n}\n\/\/ the rest works the same\nlet gearRatio = calculateGearRatio(42, 30);\nconsole.log(gearRatio); \/\/ 1.4<\/code><\/pre>\n\n\n\n<p>\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u6709\u4e00\u4e2a\u660e\u786e\u5206\u914d\u7684\u53d8\u91cf\u3002\u7531\u4e8e\u6211\u4eec\u5df2\u7ecf\u547d\u540d\u4e86\u6307\u9488\uff0c\u56e0\u6b64\u53ef\u4ee5\u5c06\u51fd\u6570\u540d\u79f0\u653e\u5728<code>function<\/code>\u5173\u952e\u5b57\u4e4b\u540e\u3002\u8fd9\u91cc\u552f\u4e00\u7684\u9677\u9631\u662f\u5fc5\u987b\u5728\u8c03\u7528\u51fd\u6570\u4e4b\u524d\u58f0\u660e\u8be5\u51fd\u6570\u3002&nbsp;<\/p>\n\n\n\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u51fd\u6570\u8868\u8fbe\u5f0f\u8fd8\u7528\u4e8e\u5c06\u51fd\u6570\u5206\u914d\u4e3a\u5bf9\u8c61\u7684\u6210\u5458\u3002\u56de\u60f3\u4e00\u4e0b\u6211\u4eec\u5c06<code>changeGear<\/code>\u529f\u80fd\u5206\u914d\u7ed9<code>Bike.prototype<\/code>\u4ec0\u4e48\u65f6\u5019\uff1f &nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Bike.prototype.changeGear = function(direction, changeBy) {\n  if (direction === 'up') {\n    this.currentGear += changeBy;\n  } else {\n    this.currentGear -= changeBy;\n  }\n}<\/code><\/pre>\n\n\n\n<p><strong>\u8fd4\u56de\u51fd\u6570<\/strong><\/p>\n\n\n\n<p>\u7531\u4e8e\u51fd\u6570\u662f\u4e00\u7c7b\u5bf9\u8c61\uff0c\u56e0\u6b64\u58f0\u660e\u51fd\u6570\u7684\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u51fd\u6570\u8fd4\u56de\u53e6\u4e00\u4e2a\u51fd\u6570\u3002\u8fd9\u79cd\u6a21\u5f0f\u901a\u5e38\u79f0\u4e3a\u5de5\u5382\u529f\u80fd\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ when invoked, this function will assign a function\nfunction gearFactory(){\n  return function(driverGear, drivenGear){\n    return (driverGear \/ drivenGear);\n  }\n}\n\/\/ calculateGearRatio can now be invoked as a function\nconst calculateGearRatio = gearFactory();\n\/\/ and all the rest<\/code><\/pre>\n\n\n\n<p>\u867d\u7136\u4e0a\u9762\u7684\u4f8b\u5b50\u5f88\u7b80\u5355\uff0c\u4f46\u662f\u5b83\u662f\u6709\u6548\u7684\u3002\u5de5\u5382\u51fd\u6570\u5bf9\u4e8e\u4e00\u6b21\u6027\u53ef\u91cd\u7528\u51fd\u6570\u5f88\u6709\u7528\uff0c\u5c24\u5176\u662f\u5728\u95ed\u5305\u4e2d\u6355\u83b7\u53d8\u91cf\u5f15\u7528\u65f6\u3002\u6211\u4eec\u5c06\u5728\u4ee5\u540e\u7684\u5355\u5143\u4e2d\u8ba8\u8bba\u95ed\u5305\u3002&nbsp;<\/p>\n\n\n\n<p><strong>\u533f\u540d\u51fd\u6570<\/strong><\/p>\n\n\n\n<p>JavaScript\u4e2d\u6709\u8bb8\u591aAPI\uff0c\u8981\u6c42\u60a8\u4f20\u9012\u4e00\u4e2a\u51fd\u6570\u624d\u80fd\u4f7f\u5b83\u4eec\u8d77\u4f5c\u7528\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u60a8\u6709\u4e00\u4e2a\u6570\u7ec4\uff0c\u5e76\u4e14\u60f3\u8981\u521b\u5efa\u4e00\u4e2a\u4ece\u8be5\u6570\u7ec4\u7684\u503c\u6d3e\u751f\u7684\u65b0\u6570\u7ec4\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u80fd\u4f1a\u4f7f\u7528\u8be5<code>Array.map<\/code>&nbsp;\u529f\u80fd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>let myArray = [1, 5, 11, 17];\nlet newArray = myArray.map( function(item){ return item \/ 2 } );\nconsole.log(newArray); \/\/ [0.5, 2.5, 5.5, 8.5]<\/code><\/pre>\n\n\n\n<p>\u5728\u6b64\u4ee3\u7801\u6bb5\u4e2d\uff0c<code>myArray.map<\/code>\u91c7\u7528\u4e00\u4e2a\u53c2\u6570\uff1a\u8be5\u51fd\u6570\u5bf9\u4e2d\u7684\u6bcf\u4e2a\u9879\u76ee\u6267\u884c\u4e00\u6b21<code>myArray<\/code>\u3002&nbsp;<\/p>\n\n\n\n<p>\u6b64\u529f\u80fd\u6c38\u8fdc\u4e0d\u4f1a\u91cd\u7528\u3002\u5b83\u88ab\u58f0\u660e\u4e3a\u4f20\u9012\u7ed9\u51fd\u6570\u7684\u53c2\u6570\uff08\u6ca1\u6709\u540d\u79f0&#8230;\u56e0\u6b64\u201c\u533f\u540d\u201d\uff09\uff0c\u5e76\u5728<code>map<\/code>\u51fd\u6570\u5b9e\u73b0\u7684\u5185\u90e8\u6267\u884c\u3002\u533f\u540d\u51fd\u6570\uff08&nbsp;\u5728\u67d0\u4e9b\u8bed\u8a00\u4e2d\u4e5f\u79f0\u4e3a<em>lambda<\/em>\uff09\u5728JavaScript\u4e2d\u5f88\u5e38\u89c1\u3002&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions#-----------function-invocation--\"><\/a>\u529f\u80fd\u8c03\u7528<\/h2>\n\n\n\n<p>\u58f0\u660e\u51fd\u6570\u540e\uff0c\u60a8\u53ef\u80fd\u60f3\u904d\u5386\u8c03\u7528\u5b83\u3002\u8c03\u7528\u51fd\u6570\u65f6\uff0c\u4f1a\u53d1\u751f\u4e00\u4e9b\u4e8b\u60c5\u3002&nbsp;<\/p>\n\n\n\n<p>\u8bf7\u8bb0\u4f4f\uff0c\u7b2c\u4e00\u4ef6\u4e8b\u662f\u5c06\u65b0\u6846\u67b6\u63a8\u5165\u5806\u6808\u3002\u7136\u540e\u5728\u5185\u5b58\u4e2d\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u5176\u53d8\u91cf\u548c\u53c2\u6570\u7684\u5bf9\u8c61\u3002<code>this<\/code>\u7136\u540e\uff0c\u5c06\u6307\u9488\u4e0e\u5176\u4ed6\u4e00\u4e9b\u7279\u6b8a\u5bf9\u8c61\u7ed1\u5b9a\u5230\u8be5\u5bf9\u8c61\u3002\u7136\u540e\uff0c\u5c06\u4f20\u9012\u7ed9\u53c2\u6570\u7684\u503c\u8d4b\u503c\uff0c\u6700\u540e\u8fd0\u884c\u65f6\u5f00\u59cb\u6267\u884c\u51fd\u6570\u4f53\u5185\u7684\u8bed\u53e5\u3002&nbsp;<\/p>\n\n\n\n<p>\u7684\u7ed1\u5b9a<code>this<\/code>\u6709\u4e00\u4e2a\u91cd\u8981\u7684\u4f8b\u5916\uff0c\u6211\u4eec\u5c06\u5728\u5f02\u6b65JavaScript\u7684\u5355\u5143\u4e2d\u91cd\u65b0\u8fdb\u884c\u8ba8\u8bba\u3002&nbsp;<\/p>\n\n\n\n<p><strong>\u8c03\u7528\u4e0e\u5206\u914d<\/strong><\/p>\n\n\n\n<p>\u4f7f\u7528\u51fd\u6570\u65f6\uff0c\u4e0eJavaScript\u65b0\u624b\u6df7\u6dc6\u7684\u4e00\u4e2a\u6f5c\u5728\u539f\u56e0\u662f\u60a8\u662f\u5206\u914d\/\u4f20\u9012\u51fd\u6570\u8fd8\u662f\u8c03\u7528\u5b83\u3002\u8fd9\u4e00\u5207\u90fd\u53d6\u51b3\u4e8e\u60a8\u662f\u5426\u4f7f\u7528<code>()<\/code>\u3002&nbsp;<\/p>\n\n\n\n<p>\u8003\u8651\u6211\u4eec\u7684\u81ea\u884c\u8f66\u5bf9\u8c61\u7684<code>calculateGearRatio<\/code>\u529f\u80fd\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>let bike = {\n  ...,\n  calculateGearRatio: function() {\n    let front = this.transmission.frontGearTeeth[this.frontGearIndex],\n    rear = this.transmission.rearGearTeeth[this.rearGearIndex];\n    return (front \/ rear);\n  },\n  ...\n}<\/code><\/pre>\n\n\n\n<p>\u73b0\u5728\u8003\u8651\u8fd9\u4e24\u79cd\u8bbf\u95ee<code>calculateGearRatio<\/code>\u51fd\u6570\u7684\u4e0d\u540c\u65b9\u5f0f\u3002 &nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ invoke function and assign value to ratioResult\nlet ratioResult = bike.calculateGearRatio();\n\/\/ assign calculateGearRatio function to a new pointer\nconst ratioFunction = bike.calculateGearRatio;<\/code><\/pre>\n\n\n\n<p>\u5728\u7b2c\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0c<code>calculateGearRatio<\/code>\u5c06\u8c03\u7528\uff0c\u5e76\u5c06\u4ece\u51fd\u6570\u8fd4\u56de\u7684\u7ed3\u679c\u5206\u914d\u7ed9\u8be5<code>ratioResult<\/code>\u53d8\u91cf\uff08\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4f5c\u4e3a\u539f\u59cb\u503c\uff09\u3002\u53e6\u4e00\u65b9\u9762<code>ratioFunction<\/code>&nbsp;\uff0c\u4ec5\u5df2\u5206\u914d\u6216\u6307\u5411\u8be5<code>calculateGearRatio<\/code>\u529f\u80fd\u3002\u7136\u540e\uff0c\u60a8\u53ef\u4ee5\u6389\u5934\u5e76\u4ee5\u65b9\u5f0f\u8c03\u7528\u5b83<code>ratioFunction<\/code>\u3002&nbsp;<\/p>\n\n\n\n<p>\u6709\u7406\u7531\u5c06\u4e00\u4e2a\u51fd\u6570\u5206\u914d\u7ed9\u53e6\u4e00\u4e2a\u6307\u9488\uff0c\u7279\u522b\u662f\u4f5c\u4e3a\u53e6\u4e00\u4e2a\u51fd\u6570\u7684\u53c2\u6570\uff0c\u5c31\u50cf\u8be5<code>Array.map()<\/code>\u51fd\u6570\u4e00\u6837\u3002\u4f46\u662f\u4f7f\u7528<code>this<\/code>\u53c2\u8003\u7684\u4efb\u4f55\u529f\u80fd\u90fd\u6709\u53ef\u80fd\u4f1a\u88ab\u7834\u574f\uff0c\u56e0\u4e3a\u5b83<code>this<\/code>\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u65f6\u95f4\u6307\u5411\u4e0d\u540c\u7684\u4e8b\u7269\u3002\u4ee5\u540e\u518d\u8bf4\u3002&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions#-----------functions-as-event-handlers--\"><\/a>\u5145\u5f53\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f<\/h2>\n\n\n\n<p>\u5982\u679c\u60a8\u5e0c\u671b\u67d0\u4e2a\u51fd\u6570\u4f5c\u4e3a\u4e8b\u4ef6\u7684\u7ed3\u679c\u800c\u89e6\u53d1\uff0c\u5219\u9700\u8981\u5c06\u5176\u8fde\u63a5\u5230\u8be5\u4e8b\u4ef6\u3002\u8fd9\u6837\u505a\u4f1a\u4f7f\u8be5\u51fd\u6570\u6210\u4e3a\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u3002\u51fd\u6570\u5b9a\u4e49\u9700\u8981\u5305\u542b\u4e00\u4e2a\u53c2\u6570\uff1a\u6307\u5411\u89e6\u53d1\u5b83\u7684\u4e8b\u4ef6\u7684\u6307\u9488\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var handleClick = function(event) {\n}<\/code><\/pre>\n\n\n\n<p>\u6bcf\u4e2a\u4e8b\u4ef6\u90fd\u5177\u6709\u544a\u8bc9\u60a8\u5904\u7406\u8be5\u4e8b\u4ef6\u6240\u9700\u4e86\u89e3\u7684\u5c5e\u6027\u3002\u4f8b\u5982\uff0c<code>click<\/code>\u60a8\u53ef\u4ee5\u68c0\u6d4b\u5230\u6709\u5173\u70b9\u51fb\u7684\u6570\u636e\uff08\u4e8b\u4ef6\u7c7b\u578b\uff0c\u89e6\u53d1\u8be5\u4e8b\u4ef6\u7684\u5143\u7d20\uff0c\u70b9\u51fb\u7684\u5750\u6807\u7b49\uff09\u3002 &nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var handleClick = function(event) {\n  console.log(event.type);  \/\/ click\n  console.log(event.currentTarget); \/\/ the thing you clicked\n  console.log(event.screenX); \/\/ screen X coordinate\n  console.log(event.screenY); \/\/ screen Y coordinate\n}<\/code><\/pre>\n\n\n\n<p><strong>\u901a\u8fc7DOM API\u5206\u914d\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f<\/strong><\/p>\n\n\n\n<p>\u5728\u7b80\u5355\u7684\u7f51\u9875\u4e2d\uff0c\u60a8\u6709\u65f6\u53ef\u80fd\u4f1a\u5728HTML\u4e2d\u770b\u5230\u663e\u5f0f\u5206\u914d\u7684\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;button onclick=\"handleClick(event)\">\n  Click to Go\n&lt;\/button><\/code><\/pre>\n\n\n\n<p>\u4f46\u662f\uff0c\u73b0\u4ee3Web\u5e94\u7528\u7a0b\u5e8f\u5f88\u5c11\u5728HTML\u4e2d\u4f7f\u7528\u4e8b\u4ef6\u7ed1\u5b9a\u3002\u76f8\u53cd\uff0c\u9996\u9009DOM API\uff0c\u7279\u522b\u662fJavaScript&nbsp;<code>Element.addEventListener()<\/code>\u51fd\u6570\u3002&nbsp;<\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5bf9HTML\u5143\u7d20\u7684\u5f15\u7528\u3002\u4e0b\u9762\uff0c\u6211\u4eec\u5728<code>id<\/code>\u6309\u94ae\u4e2d\u6dfb\u52a0\u4e86\u4e00\u4e2a\u5c5e\u6027\uff0c\u5e76\u5220\u9664\u4e86onclick\u5c5e\u6027\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;button id=\u201dclicker\u201d><\/code><\/pre>\n\n\n\n<p>\u73b0\u5728\u6211\u4eec\u8fdb\u5165DOM\uff0c\u83b7\u53d6\u5bf9\u6309\u94ae\u7684\u5f15\u7528\uff0c\u5e76\u901a\u8fc7\u5c06\u4e8b\u4ef6\u4fa6\u542c\u5668<code>handleClick<\/code>\u4f5c\u4e3a\u503c\uff08\u6ce8\u610f\uff0c\u4e0d\u5e26\u62ec\u53f7\uff09\u4f20\u9012\u7ed9\u4e8b\u4ef6\u4fa6\u542c\u5668\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>let button = document.getElementById(\"clicker\");\nbutton.addEventListener(\"click\", handleClick);<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528DOM API\u53ef\u4f7f\u5f00\u53d1\u4eba\u5458\u7075\u6d3b\u5730\u4f7fUI\u9ad8\u5ea6\u4ea4\u4e92\u5e76\u54cd\u5e94\u7528\u6237\u7684\u64cd\u4f5c\u3002\u5982\u679c\u9700\u8981\u5173\u95ed\u529f\u80fd\uff0c\u5f00\u53d1\u4eba\u5458\u8fd8\u53ef\u4ee5\u5220\u9664\u4e8b\u4ef6\u4fa6\u542c\u5668\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>button.removeEventListener(\"click\", handleClick);<\/code><\/pre>\n\n\n\n<p>\u60a8\u8fd8\u5c06\u770b\u5230\u533f\u540d\u51fd\u6570\u6dfb\u52a0\u4e3a\u4e8b\u4ef6\u4fa6\u542c\u5668\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>button.addEventListener(\"click\", function(event){\n  \/\/...anonymous function body...\n});<\/code><\/pre>\n\n\n\n<p>\u8bf7\u8bb0\u4f4f\uff0c\u4e0d\u80fd\u4f7f\u7528\u6765\u5220\u9664\u533f\u540d\u51fd\u6570<code>removeEventListener<\/code>\uff0c\u56e0\u4e3a\u6ca1\u6709\u6307\u9488\u53ef\u4ee5\u4f20\u5165\u4ee5\u8bc6\u522b\u8be5\u51fd\u6570\u3002&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions#-----------events-and-functions-in-lightning-web-components--\"><\/a>Lightning Web Components\u4e2d\u7684\u4e8b\u4ef6\u548c\u529f\u80fd<\/h2>\n\n\n\n<p>Lightning Web\u7ec4\u4ef6\u7684\u5173\u952e\u4ee3\u7801\u5de5\u4ef6\u662fJavaScript\u6a21\u5757\uff0cHTML\u6a21\u677f\u548cCSS\u6587\u4ef6\u3002\u5176\u4e2d\u552f\u4e00\u9700\u8981\u7684\u662fJavaScript\u6a21\u5757\uff08\u6ce8\u610f\uff0c<code>.xml<\/code>\u8fd8\u9700\u8981\u7684\u6587\u4ef6\u4e0d\u662f\u4ee3\u7801\uff0c\u800c\u662f\u6709\u5173\u7ec4\u4ef6\u7684\u5143\u6570\u636e\uff09\u3002&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/hy4kyit2a\/f_auto,fl_lossy,q_70\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions\/images\/d7ec3d87b03234d7c2362cccf30f23a2_cju-3398-xj-00180-z-9838-tz-9-ido.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Lightning Web\u7ec4\u4ef6\u4e2d\u7684\u529f\u80fd\u901a\u5e38\u4ee5\u65b9\u6cd5\u7684\u5f62\u5f0f\u51fa\u73b0\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u662f\u8be5\u7ec4\u4ef6\u7684JavaScript\u6a21\u5757\u5bfc\u51fa\u7684\u7c7b\u7684\u6210\u5458\u3002\u8fd9\u4e9b\u51fd\u6570\u53ef\u4ee5\u662f\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\uff0c\u4e5f\u53ef\u4ee5\u662f\u4ece\u4e0b\u6e38\u5411\u4e0b\u6e38\u8c03\u7528\u7684\u5176\u4ed6\u51fd\u6570\u3002&nbsp;<\/p>\n\n\n\n<p>HTML\u6a21\u677f\u4ee5\u7c7b\u4f3c\u4e8e\u9759\u6001HTML\u7ed1\u5b9a\u7684\u65b9\u5f0f\u5f15\u7528\u5904\u7406\u7a0b\u5e8f\u51fd\u6570\uff0c\u4f46\u5b9e\u9645\u4e0a\u662f\u4e0d\u540c\u7684\u3002\u7531\u4e8e\u6a21\u677f\u5df2\u7f16\u8bd1\u4e3aJavaScript\u5de5\u4ef6\uff0c\u56e0\u6b64\u770b\u8d77\u6765\u9759\u6001\u7684\u7ed1\u5b9a\u5b9e\u9645\u4e0a\u53ea\u662f\u6846\u67b6<code>addEventListener<\/code>\u5728\u7ec4\u4ef6\u751f\u547d\u5468\u671f\u4e2d\u67d0\u4e2a\u65f6\u95f4\u8c03\u7528\u7684\u8bed\u6cd5\u7ea6\u5b9a\u3002&nbsp;<\/p>\n\n\n\n<p>\u6a21\u677f\u4e2d\u7684\u6b64\u6807\u8bb0\u663e\u793a\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u7ed1\u5b9a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;lightning-input onchange={handleChange} label=\"Input Text\" value={text}>\n&lt;\/lightning-input><\/code><\/pre>\n\n\n\n<p>\u8fd9\u662f\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u3002&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    handleChange(event){\n        this.text = event.target.value;\n    }<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/hy4kyit2a\/image\/upload\/doc\/trailhead\/en-usb473bb5ea1b7e61dfb07e6a7e547de6b.gif\" alt=\"\u6ce8\u610f\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions#note\"><\/a>\u6ce8\u610f<\/h4>\n\n\n\n<p>Lightning Web Components\u4e2d\u6709\u8bb8\u591a\u4e8b\u4ef6\u7684\u66f4\u9ad8\u7ea7\u7684\u529f\u80fd\u3002\u8981\u63a2\u7d22\u8fd9\u4e9b\u529f\u80fd\uff0c\u8bf7\u5b8c\u6210Lightning Web Components\u57fa\u7840\u77e5\u8bc6\u6a21\u5757\uff0c\u6216\u6df1\u5165\u7814\u7a76\u5176\u4e2d\u4e00\u4e2a\u793a\u4f8b\u00a0\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4e60\u76ee\u6807 \u5b8c\u6210\u672c\u5355\u5143\u540e\uff0c\u60a8\u5c06\u80fd\u591f\uff1a \u5b9a\u4e49\u529f\u80fd \u533a\u5206\u51fd\u6570\u58f0\u660e\u548c\u51fd\u6570\u8868\u8fbe\u5f0f \u8c03\u7528\u529f\u80fd \u4f20\u9012\u548c\u5206\u914d\u529f\u80fd \u63cf\u8ff0\u95ea\u7535\u7f51\u7edc &hellip; <a href=\"http:\/\/www.ponybai.com\/?p=3497\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-3497","post","type-post","status-publish","format-standard","hentry","category-lwcjavascript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8 - \u767d\u767d\u968f\u7b14<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.ponybai.com\/?p=3497\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8 - \u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"og:description\" content=\"\u5b66\u4e60\u76ee\u6807 \u5b8c\u6210\u672c\u5355\u5143\u540e\uff0c\u60a8\u5c06\u80fd\u591f\uff1a \u5b9a\u4e49\u529f\u80fd \u533a\u5206\u51fd\u6570\u58f0\u660e\u548c\u51fd\u6570\u8868\u8fbe\u5f0f \u8c03\u7528\u529f\u80fd \u4f20\u9012\u548c\u5206\u914d\u529f\u80fd \u63cf\u8ff0\u95ea\u7535\u7f51\u7edc &hellip; \u7ee7\u7eed\u9605\u8bfbSalesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.ponybai.com\/?p=3497\" \/>\n<meta property=\"og:site_name\" content=\"\u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-25T15:26:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/hy4kyit2a\/f_auto,fl_lossy,q_70\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions\/images\/4999e793b0432e8c4e10e440784ca5f5_cjksehj-0-s-000-w-0-t-6-rvvlpiln-9.png\" \/>\n<meta name=\"author\" content=\"ponybai\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"ponybai\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3497#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3497\"},\"author\":{\"name\":\"ponybai\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"headline\":\"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8\",\"datePublished\":\"2020-06-25T15:26:55+00:00\",\"dateModified\":\"2020-06-25T15:26:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3497\"},\"wordCount\":98,\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"articleSection\":[\"LWC\u4e2d\u7684Javascript\"],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3497\",\"url\":\"http:\/\/www.ponybai.com\/?p=3497\",\"name\":\"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8 - \u767d\u767d\u968f\u7b14\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/#website\"},\"datePublished\":\"2020-06-25T15:26:55+00:00\",\"dateModified\":\"2020-06-25T15:26:55+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3497#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.ponybai.com\/?p=3497\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3497#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/www.ponybai.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ponybai.com\/#website\",\"url\":\"http:\/\/www.ponybai.com\/\",\"name\":\"\u767d\u767d\u968f\u7b14\",\"description\":\"Salesforce\u5b98\u65b9\u8bb2\u5e08\",\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ponybai.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\",\"name\":\"ponybai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"contentUrl\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"width\":248,\"height\":248,\"caption\":\"ponybai\"},\"logo\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/121.37.188.161\"],\"url\":\"http:\/\/www.ponybai.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8 - \u767d\u767d\u968f\u7b14","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.ponybai.com\/?p=3497","og_locale":"zh_CN","og_type":"article","og_title":"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8 - \u767d\u767d\u968f\u7b14","og_description":"\u5b66\u4e60\u76ee\u6807 \u5b8c\u6210\u672c\u5355\u5143\u540e\uff0c\u60a8\u5c06\u80fd\u591f\uff1a \u5b9a\u4e49\u529f\u80fd \u533a\u5206\u51fd\u6570\u58f0\u660e\u548c\u51fd\u6570\u8868\u8fbe\u5f0f \u8c03\u7528\u529f\u80fd \u4f20\u9012\u548c\u5206\u914d\u529f\u80fd \u63cf\u8ff0\u95ea\u7535\u7f51\u7edc &hellip; \u7ee7\u7eed\u9605\u8bfbSalesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8","og_url":"http:\/\/www.ponybai.com\/?p=3497","og_site_name":"\u767d\u767d\u968f\u7b14","article_published_time":"2020-06-25T15:26:55+00:00","og_image":[{"url":"https:\/\/res.cloudinary.com\/hy4kyit2a\/f_auto,fl_lossy,q_70\/learn\/modules\/javascript-essentials-salesforce-developers\/take-action-events-functions\/images\/4999e793b0432e8c4e10e440784ca5f5_cjksehj-0-s-000-w-0-t-6-rvvlpiln-9.png"}],"author":"ponybai","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"ponybai","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.ponybai.com\/?p=3497#article","isPartOf":{"@id":"http:\/\/www.ponybai.com\/?p=3497"},"author":{"name":"ponybai","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"headline":"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8","datePublished":"2020-06-25T15:26:55+00:00","dateModified":"2020-06-25T15:26:55+00:00","mainEntityOfPage":{"@id":"http:\/\/www.ponybai.com\/?p=3497"},"wordCount":98,"publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"articleSection":["LWC\u4e2d\u7684Javascript"],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/www.ponybai.com\/?p=3497","url":"http:\/\/www.ponybai.com\/?p=3497","name":"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8 - \u767d\u767d\u968f\u7b14","isPartOf":{"@id":"http:\/\/www.ponybai.com\/#website"},"datePublished":"2020-06-25T15:26:55+00:00","dateModified":"2020-06-25T15:26:55+00:00","breadcrumb":{"@id":"http:\/\/www.ponybai.com\/?p=3497#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.ponybai.com\/?p=3497"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.ponybai.com\/?p=3497#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/www.ponybai.com\/"},{"@type":"ListItem","position":2,"name":"Salesforce\u5f00\u53d1\u4eba\u5458\u7684JavaScript\u6280\u80fd-\u5bf9\u4e8b\u4ef6\u548c\u529f\u80fd\u91c7\u53d6\u884c\u52a8"}]},{"@type":"WebSite","@id":"http:\/\/www.ponybai.com\/#website","url":"http:\/\/www.ponybai.com\/","name":"\u767d\u767d\u968f\u7b14","description":"Salesforce\u5b98\u65b9\u8bb2\u5e08","publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ponybai.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883","name":"ponybai","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/","url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","contentUrl":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","width":248,"height":248,"caption":"ponybai"},"logo":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/121.37.188.161"],"url":"http:\/\/www.ponybai.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/3497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3497"}],"version-history":[{"count":0,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/3497\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3497"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}