{"id":191165,"date":"2023-08-23T07:51:20","date_gmt":"2023-08-22T23:51:20","guid":{"rendered":"https:\/\/www.idc.net\/help\/191165\/"},"modified":"2023-08-23T07:51:20","modified_gmt":"2023-08-22T23:51:20","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91knockout%e6%95%99%e7%a8%8b%ef%bc%9a%e7%bb%91%e5%ae%9a%e8%af%ad%e6%b3%95%ef%bc%882%ef%bc%89","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/191165\/","title":{"rendered":"\u540e\u6d6a\u4e91Knockout\u6559\u7a0b\uff1a\u7ed1\u5b9a\u8bed\u6cd5\uff082\uff09"},"content":{"rendered":"<h2>7&nbsp;&nbsp; click \u7ed1\u5b9a<\/h2>\n<p><strong>\u76ee\u7684<\/strong><\/p>\n<p>click\u7ed1\u5b9a\u5728DOM\u5143\u7d20\u4e0a\u6dfb\u52a0\u4e8b\u4ef6\u53e5\u67c4\u4ee5\u4fbf\u5143\u7d20\u88ab\u70b9\u51fb\u7684\u65f6\u5019\u6267\u884c\u5b9a\u4e49\u7684JavaScript \u51fd\u6570\u3002\u5927\u90e8\u5206\u662f\u7528\u5728button\uff0cinput\u548c\u8fde\u63a5a\u4e0a\uff0c\u4f46\u662f\u53ef\u4ee5\u5728\u4efb\u610f\u5143\u7d20\u4e0a\u4f7f\u7528\u3002<\/p>\n<p><strong>\u4f8b\u5b50<\/strong><\/p>\n<pre><code>&lt;div&gt;\n    You've clicked &lt;span data-bind=\"text: numberOfClicks\"&gt;&lt;\/span&gt; times\n    &lt;button data-bind=\"click: incrementClickCounter\"&gt;Click me&lt;\/button&gt;\n&lt;\/div&gt;\n\n&lt;script type=\"text\/javascript\"&gt;\n    var viewModel = {\n        numberOfClicks: ko.observable(0),\n        incrementClickCounter: function () {\n            var previousCount =this.numberOfClicks();\n            this.numberOfClicks(previousCount +1);\n        }\n    };\n&lt;\/script&gt;<\/code><\/pre>\n<p>\u6bcf\u6b21\u70b9\u51fb\u6309\u94ae\u7684\u65f6\u5019\uff0c\u90fd\u4f1a\u8c03\u7528incrementClickCounter()\u51fd\u6570\uff0c\u7136\u540e\u66f4\u65b0\u81ea\u52a8\u66f4\u65b0\u70b9\u51fb\u6b21\u6570\u3002<\/p>\n<p><strong>\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;<strong>\u4e3b\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp; Click\u70b9\u51fb\u4e8b\u4ef6\u65f6\u6240\u6267\u884c\u7684\u51fd\u6570\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp; \u4f60\u53ef\u4ee5\u58f0\u660e\u4efb\u4f55JavaScript\u51fd\u6570 \u2013 \u4e0d\u4e00\u5b9a\u975e\u8981\u662fview model\u91cc\u7684\u51fd\u6570\u3002\u4f60\u53ef\u4ee5\u58f0\u660e\u4efb\u610f\u5bf9\u8c61\u4e0a\u7684\u4efb\u4f55\u51fd\u6570\uff0c\u4f8b\u5982\uff1a&nbsp;someObject.someFunction\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp; View model\u4e0a\u7684\u51fd\u6570\u5728\u7528\u7684\u65f6\u5019\u6709\u4e00\u70b9\u70b9\u7279\u6b8a\uff0c\u5c31\u662f\u4e0d\u9700\u8981\u5f15\u7528\u5bf9\u8c61\u7684\uff0c\u76f4\u63a5\u5f15\u7528\u51fd\u6570\u672c\u8eab\u5c31\u884c\u4e86\uff0c\u6bd4\u5982\u76f4\u63a5\u5199incrementClickCounter&nbsp;\u5c31\u53ef\u4ee5\u4e86\uff0c\u800c\u65e0\u9700\u5199\u6210\uff1a&nbsp;viewModel.incrementClickCounter\uff08\u5c3d\u7ba1\u662f\u5408\u6cd5\u7684\uff09\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<strong>\u5176\u5b83\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u65e0<\/p>\n<p><strong>\u6ce81\uff1a\u4f20\u53c2\u6570\u7ed9\u4f60\u7684click \u53e5\u67c4<\/strong><\/p>\n<p>\u6700\u7b80\u5355\u7684\u529e\u6cd5\u662f\u4f20\u4e00\u4e2afunction\u5305\u88c5\u7684\u533f\u540d\u51fd\u6570\uff1a<\/p>\n<pre><code>&lt;button data-bind=\"click: function() { viewModel.myFunction('param1', 'param2') }\"&gt;\n    Click me\n&lt;\/button&gt;<\/code><\/pre>\n<p>\u8fd9\u6837\uff0cKO\u5c31\u4f1a\u8c03\u7528\u8fd9\u4e2a\u533f\u540d\u51fd\u6570\uff0c\u91cc\u9762\u4f1a\u6267\u884cviewModel.myFunction()\uff0c\u5e76\u4e14\u4f20\u8fdb\u4e86'param1' \u548c'param2'\u53c2\u6570\u3002<\/p>\n<p><strong>\u6ce82\uff1a\u8bbf\u95ee\u4e8b\u4ef6\u6e90\u5bf9\u8c61<\/strong><\/p>\n<p>\u6709\u4e9b\u60c5\u51b5\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u4e8b\u4ef6\u6e90\u5bf9\u8c61\uff0cKnockout\u4f1a\u5c06\u8fd9\u4e2a\u5bf9\u8c61\u4f20\u9012\u5230\u4f60\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\uff1a<\/p>\n<pre><code>&lt;button data-bind=\"click: myFunction\"&gt;\n    Click me\n&lt;\/button&gt;\n\n &lt;script type=\"text\/javascript\"&gt;\n     var viewModel = {\n         myFunction: function (event) {\n             if (event.shiftKey) {\n                 \/\/do something different when user has shift key down\n             } else {\n                 \/\/do normal action\n             }\n         }\n     };\n&lt;\/script&gt;<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u9700\u8981\u7684\u8bdd\uff0c\u53ef\u4ee5\u4f7f\u7528\u533f\u540d\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u4f20\u8fdb\u53bb\uff0c\u7136\u540e\u5728\u91cc\u9762\u8c03\u7528\uff1a<\/p>\n<pre><code>&lt;button data-bind=\"click: function(event) { viewModel.myFunction(event, 'param1', 'param2') }\"&gt;\n    Click me\n&lt;\/button&gt;<\/code><\/pre>\n<p>\u8fd9\u6837\uff0cKO\u5c31\u4f1a\u5c06\u4e8b\u4ef6\u6e90\u5bf9\u8c61\u4f20\u9012\u7ed9\u4f60\u7684\u51fd\u6570\u5e76\u4e14\u4f7f\u7528\u4e86\u3002<\/p>\n<p><strong>\u6ce83: \u5141\u8bb8\u6267\u884c\u9ed8\u8ba4\u4e8b\u4ef6<\/strong><\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cKnockout\u4f1a\u963b\u6b62\u5192\u6ce1\uff0c\u9632\u6b62\u9ed8\u8ba4\u7684\u4e8b\u4ef6\u7ee7\u7eed\u6267\u884c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u70b9\u51fb\u4e00\u4e2aa\u8fde\u63a5\uff0c\u5728\u6267\u884c\u5b8c\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u65f6\u5b83\u4e0d\u4f1a\u8fde\u63a5\u5230href\u5730\u5740\u3002\u8fd9\u7279\u522b\u6709\u7528\u662f\u56e0\u4e3a\u4f60\u7684\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u4e3b\u8981\u5c31\u662f\u64cd\u4f5c\u4f60\u7684view model\uff0c\u800c\u4e0d\u662f\u8fde\u63a5\u5230\u53e6\u5916\u4e00\u4e2a\u9875\u9762\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u5982\u679c\u4f60\u60f3\u8ba9\u9ed8\u8ba4\u7684\u4e8b\u4ef6\u7ee7\u7eed\u6267\u884c\uff0c\u4f60\u53ef\u4ee5\u5728\u4f60click\u7684\u81ea\u5b9a\u4e49\u51fd\u6570\u91cc\u8fd4\u56detrue\u3002<\/p>\n<p><strong>\u6ce84\uff1a\u63a7\u5236this\u53e5\u67c4<\/strong><\/p>\n<p>\u521d\u5b66\u8005\u53ef\u4ee5\u5ffd\u7565\u8fd9\u5c0f\u8282\uff0c\u56e0\u4e3a\u5927\u90e8\u5206\u90fd\u7528\u4e0d\u7740\uff0c\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u53c2\u8003\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p>KO\u5728\u8c03\u7528\u4f60\u5b9a\u4e49\u7684\u51fd\u6570\u65f6\uff0c\u4f1a\u5c06view model\u4f20\u7ed9this\u5bf9\u8c61\uff08\u4e5f\u5c31\u662fko.applyBindings\u4f7f\u7528\u7684view model\uff09\u3002\u4e3b\u8981\u662f\u65b9\u4fbf\u4f60\u5728\u8c03\u7528\u4f60\u5728view model\u91cc\u5b9a\u4e49\u7684\u65b9\u6cd5\u7684\u65f6\u5019\u53ef\u4ee5\u5f88\u5bb9\u6613\u518d\u8c03\u7528view model\u91cc\u5b9a\u4e49\u7684\u5176\u5b83\u5c5e\u6027\u3002\u4f8b\u5982\uff1a this.someOtherViewModelProperty\u3002<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u5f15\u7528\u5176\u5b83\u5bf9\u8c61\uff0c\u6211\u4eec\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a<\/p>\n<ul>\n<li>\n<p>\u4f60\u53ef\u4ee5\u548c\u6ce81\u91cc\u90a3\u6837\u4f7f\u7528\u533f\u540d\u51fd\u6570\uff0c\u56e0\u4e3a\u5b83\u652f\u6301\u4efb\u610fJavaScript \u5bf9\u8c61\u3002<\/p>\n<\/li>\n<li>\u4f60\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5f15\u7528\u4efb\u4f55\u51fd\u6570\u5bf9\u8c61\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528bind\u4f7fcallback\u51fd\u6570\u8bbe\u7f6ethis\u4e3a\u4efb\u4f55\u4f60\u9009\u62e9\u7684\u5bf9\u8c61\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ul>\n<pre><code>&lt;button data-bind=\"click: someObject.someFunction.bind(someObject)\"&gt;\n    Click me\n&lt;\/button&gt;<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u662fC#\u6216Java\u5f00\u53d1\u4eba\u5458\uff0c\u4f60\u53ef\u4ee5\u7591\u60d1\u4e3a\u4ec0\u4e48\u6211\u4eec\u8fd8\u8981\u7528bind\u51fd\u6570\u5230\u4e00\u4e2a\u5bf9\u8c61\u60f3\uff0c\u7279\u522b\u662f\u50cf\u8c03\u7528someObject.someFunction\u3002 \u539f\u56e0\u662f\u5728JavaScript\u91cc\uff0c\u51fd\u6570\u81ea\u5df1\u4e0d\u662f\u7c7b\u7684\u4e00\u90e8\u5206\uff0c\u4ed6\u4eec\u5728\u5355\u72ec\u5b58\u5728\u7684\u5bf9\u8c61\uff0c\u6709\u53ef\u80fd\u591a\u4e2a\u5bf9\u8c61\u90fd\u5f15\u7528\u540c\u6837\u7684someFunction\u51fd\u6570\uff0c\u6240\u4ee5\u5f53\u8fd9\u4e2a\u51fd\u6570\u88ab\u8c03\u7528\u7684\u65f6\u5019\u5b83\u4e0d\u77e5\u9053\u8c01\u8c03\u7528\u7684\uff08\u8bbe\u7f6ethis\u7ed9\u8c01\uff09\u3002\u5728\u4f60bind\u4e4b\u524d\u8fd0\u884c\u65f6\u662f\u4e0d\u4f1a\u77e5\u9053\u7684\u3002KO\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u8bbe\u7f6ethis\u5bf9\u8c61\u662fview model\uff0c\u4f46\u4f60\u53ef\u4ee5\u7528bind\u8bed\u6cd5\u91cd\u5b9a\u4e49\u5b83\u3002<\/p>\n<p>\u5728\u6ce81\u91cc\u4f7f\u7528\u533f\u540d\u51fd\u6570\u7684\u65f6\u5019\u6ca1\u6709\u5177\u4f53\u7684\u8981\u6c42\uff0c\u56e0\u4e3aJavaScript\u4ee3\u7801&nbsp;someObject.someFunction()\u5c31\u610f\u5473\u7740\u8c03\u7528someFunction\uff0c\u7136\u540e\u8bbe\u7f6ethis\u5230 someObject\u5bf9\u8c61\u4e0a\u3002<\/p>\n<p><strong>\u6ce85\uff1a\u9632\u6b62\u4e8b\u4ef6\u5192\u6ce1<\/strong><\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cKnockout\u5141\u8bb8click\u4e8b\u4ef6\u7ee7\u7eed\u5728\u66f4\u9ad8\u4e00\u5c42\u7684\u4e8b\u4ef6\u53e5\u67c4\u4e0a\u5192\u6ce1\u6267\u884c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684\u5143\u7d20\u548c\u7236\u5143\u7d20\u90fd\u7ed1\u5b9a\u4e86click\u4e8b\u4ef6\uff0c\u90a3\u5f53\u4f60\u70b9\u51fb\u8be5\u5143\u7d20\u7684\u65f6\u5019\u4e24\u4e2a\u4e8b\u4ef6\u90fd\u4f1a\u89e6\u53d1\u7684\u3002\u5982\u679c\u9700\u8981\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u989d\u5916\u7684\u7ed1\u5b9aclickBubble\u6765\u7981\u6b62\u5192\u6ce1\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>&lt;div data-bind=\"click: myDivHandler\"&gt;\n    &lt;button data-bind=\"click: myButtonHandler, clickBubble: false\"&gt;\n        Click me\n    &lt;\/button&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cmyButtonHandler\u4f1a\u5148\u6267\u884c\uff0c\u7136\u540e\u4f1a\u5192\u6ce1\u6267\u884cmyDivHandler\u3002\u4f46\u4e00\u65e6\u4f60\u8bbe\u7f6e\u4e86clickBubble\u4e3afalse\u7684\u65f6\u5019\uff0c\u5192\u6ce1\u4e8b\u4ef6\u4f1a\u88ab\u7981\u6b62\u3002<\/p>\n<p><strong>\u4f9d\u8d56\u6027<\/strong><\/p>\n<p>\u9664KO\u6838\u5fc3\u7c7b\u5e93\u5916\uff0c\u65e0\u4f9d\u8d56\u3002<\/p>\n<h2>8&nbsp;&nbsp; event \u7ed1\u5b9a<\/h2>\n<p><strong>\u76ee\u7684<\/strong><\/p>\n<p>event\u7ed1\u5b9a\u5728DOM\u5143\u7d20\u4e0a\u6dfb\u52a0\u6307\u5b9a\u7684\u4e8b\u4ef6\u53e5\u67c4\u4ee5\u4fbf\u5143\u7d20\u88ab\u89e6\u53d1\u7684\u65f6\u5019\u6267\u884c\u5b9a\u4e49\u7684JavaScript \u51fd\u6570\u3002\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u662f\u7528\u5728keypress\uff0cmouseover\u548cmouseout\u4e0a\u3002<\/p>\n<p><strong>\u4f8b\u5b50<\/strong><\/p>\n<pre><code>&lt;div&gt;\n    &lt;div data-bind=\"event: { mouseover: enableDetails, mouseout: disableDetails }\"&gt;\n        Mouse over me\n    &lt;\/div&gt;\n    &lt;div data-bind=\"visible: detailsEnabled\"&gt;\n        Details\n    &lt;\/div&gt;\n&lt;\/div&gt;\n\n&lt;script type=\"text\/javascript\"&gt;\n    var viewModel = {\n        detailsEnabled: ko.observable(false),\n        enableDetails: function () {\n            this.detailsEnabled(true);\n        },\n        disableDetails: function () {\n            this.detailsEnabled(false);\n        }\n    };\n&lt;\/script&gt;<\/code><\/pre>\n<p>\u6bcf\u6b21\u9f20\u6807\u5728\u7b2c\u4e00\u4e2a\u5143\u7d20\u4e0a\u79fb\u5165\u79fb\u51fa\u7684\u65f6\u5019\u90fd\u4f1a\u8c03\u7528view model\u4e0a\u7684\u65b9\u6cd5\u6765toggle detailsEnabled\u7684\u503c\uff0c\u800c\u7b2c\u4e8c\u4e2a\u5143\u7d20\u4f1a\u6839\u636edetailsEnabled\u7684\u503c\u81ea\u52a8\u663e\u793a\u6216\u8005\u9690\u85cf\u3002<\/p>\n<p><strong>\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;<strong>\u4e3b\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp; \u4f60\u9700\u8981\u4f20\u5165\u7684\u662f\u4e00\u4e2aJavaScript\u5bf9\u8c61\uff0c\u4ed6\u7684\u5c5e\u6027\u540d\u662f\u4e8b\u4ef6\u540d\u79f0\uff0c\u503c\u662f\u4f60\u6240\u9700\u8981\u6267\u884c\u7684\u51fd\u6570\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp; \u4f60\u53ef\u4ee5\u58f0\u660e\u4efb\u4f55JavaScript\u51fd\u6570 \u2013 \u4e0d\u4e00\u5b9a\u975e\u8981\u662fview model\u91cc\u7684\u51fd\u6570\u3002\u4f60\u53ef\u4ee5\u58f0\u660e\u4efb\u610f\u5bf9\u8c61\u4e0a\u7684\u4efb\u4f55\u51fd\u6570\uff0c\u4f8b\u5982\uff1a&nbsp;event: { mouseover: someObject.someFunction }\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp; View model\u4e0a\u7684\u51fd\u6570\u5728\u7528\u7684\u65f6\u5019\u6709\u4e00\u70b9\u70b9\u7279\u6b8a\uff0c\u5c31\u662f\u4e0d\u9700\u8981\u5f15\u7528\u5bf9\u8c61\u7684\uff0c\u76f4\u63a5\u5f15\u7528\u51fd\u6570\u672c\u8eab\u5c31\u884c\u4e86\uff0c\u6bd4\u5982\u76f4\u63a5\u5199event: { mouseover: enableDetails }&nbsp;\u5c31\u53ef\u4ee5\u4e86\uff0c\u800c\u65e0\u9700\u5199\u6210\uff1a&nbsp;event: { mouseover: viewModel.enableDetails }\uff08\u5c3d\u7ba1\u662f\u5408\u6cd5\u7684\uff09\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<strong>\u5176\u5b83\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u65e0<\/p>\n<p><strong>\u6ce81\uff1a\u4f20\u53c2\u6570\u7ed9\u4f60\u7684click \u53e5\u67c4<\/strong><\/p>\n<p>\u6700\u7b80\u5355\u7684\u529e\u6cd5\u662f\u4f20\u4e00\u4e2afunction\u5305\u88c5\u7684\u533f\u540d\u51fd\u6570\uff1a<\/p>\n<pre><code>&lt;button data-bind=\"event: { mouseover: function() { viewModel.myFunction('param1', 'param2') } }\"&gt;\n    Click me\n&lt;\/button&gt;<\/code><\/pre>\n<p>\u8fd9\u6837\uff0cKO\u5c31\u4f1a\u8c03\u7528\u8fd9\u4e2a\u533f\u540d\u51fd\u6570\uff0c\u91cc\u9762\u4f1a\u6267\u884cviewModel.myFunction()\uff0c\u5e76\u4e14\u4f20\u8fdb\u4e86'param1' \u548c'param2'\u53c2\u6570\u3002<\/p>\n<p><strong>\u6ce82\uff1a\u8bbf\u95ee\u4e8b\u4ef6\u6e90\u5bf9\u8c61<\/strong><\/p>\n<p>\u6709\u4e9b\u60c5\u51b5\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u4e8b\u4ef6\u6e90\u5bf9\u8c61\uff0cKnockout\u4f1a\u5c06\u8fd9\u4e2a\u5bf9\u8c61\u4f20\u9012\u5230\u4f60\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\uff1a<\/p>\n<pre><code>&lt;div data-bind=\"event: { mouseover: myFunction }\"&gt;\n    Mouse over me\n&lt;\/div&gt;\n\n &lt;script type=\"text\/javascript\"&gt;\n     var viewModel = {\n         myFunction: function (event) {\n             if (event.shiftKey) {\n                 \/\/do something different when user has shift key down\n             } else {\n                 \/\/do normal action\n             }\n         }\n     };\n&lt;\/script&gt;<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u9700\u8981\u7684\u8bdd\uff0c\u53ef\u4ee5\u4f7f\u7528\u533f\u540d\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u4f20\u8fdb\u53bb\uff0c\u7136\u540e\u5728\u91cc\u9762\u8c03\u7528\uff1a<\/p>\n<pre><code>&lt;div data-bind=\"event: { mouseover: function(event) { viewModel.myFunction(event, 'param1', 'param2') } }\"&gt;\n    Mouse over me\n&lt;\/div&gt;<\/code><\/pre>\n<p>\u8fd9\u6837\uff0cKO\u5c31\u4f1a\u5c06\u4e8b\u4ef6\u6e90\u5bf9\u8c61\u4f20\u9012\u7ed9\u4f60\u7684\u51fd\u6570\u5e76\u4e14\u4f7f\u7528\u4e86\u3002<\/p>\n<p><strong>\u6ce83: \u5141\u8bb8\u6267\u884c\u9ed8\u8ba4\u4e8b\u4ef6<\/strong><\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cKnockout\u4f1a\u963b\u6b62\u5192\u6ce1\uff0c\u9632\u6b62\u9ed8\u8ba4\u7684\u4e8b\u4ef6\u7ee7\u7eed\u6267\u884c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5728\u4e00\u4e2ainput\u6807\u7b7e\u4e0a\u7ed1\u5b9a\u4e00\u4e2akeypress\u4e8b\u4ef6\uff0c\u5f53\u4f60\u8f93\u5165\u5185\u5bb9\u7684\u65f6\u5019\uff0c\u6d4f\u89c8\u5668\u53ea\u4f1a\u8c03\u7528\u4f60\u7684\u51fd\u6570\u800c\u4e0d\u662f\u5929\u4ef7\u4f60\u8f93\u5165\u7684\u503c\u3002\u53e6\u5916\u4e00\u4e2a\u4f8b\u5b50click\u7ed1\u5b9a\uff0c\u5f53\u4f60\u70b9\u51fb\u4e00\u4e2aa\u8fde\u63a5\uff0c\u5728\u6267\u884c\u5b8c\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u65f6\u5b83\u4e0d\u4f1a\u8fde\u63a5\u5230href\u5730\u5740\u3002\u56e0\u4e3a\u4f60\u7684\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u4e3b\u8981\u5c31\u662f\u64cd\u4f5c\u4f60\u7684view model\uff0c\u800c\u4e0d\u662f\u8fde\u63a5\u5230\u53e6\u5916\u4e00\u4e2a\u9875\u9762\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u5982\u679c\u4f60\u60f3\u8ba9\u9ed8\u8ba4\u7684\u4e8b\u4ef6\u7ee7\u7eed\u6267\u884c\uff0c\u4f60\u53ef\u4ee5\u5728\u4f60event\u7684\u81ea\u5b9a\u4e49\u51fd\u6570\u91cc\u8fd4\u56detrue\u3002<\/p>\n<p><strong>\u6ce84\uff1a\u63a7\u5236this\u53e5\u67c4<\/strong><\/p>\n<p>\u521d\u5b66\u8005\u53ef\u4ee5\u5ffd\u7565\u8fd9\u5c0f\u8282\uff0c\u56e0\u4e3a\u5927\u90e8\u5206\u90fd\u7528\u4e0d\u7740\uff0c\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u53c2\u8003\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p>KO\u5728\u8c03\u7528\u4f60\u5b9a\u4e49\u7684event\u7ed1\u5b9a\u51fd\u6570\u65f6\uff0c\u4f1a\u5c06view model\u4f20\u7ed9this\u5bf9\u8c61\uff08\u4e5f\u5c31\u662fko.applyBindings\u4f7f\u7528\u7684view model\uff09\u3002\u4e3b\u8981\u662f\u65b9\u4fbf\u4f60\u5728\u8c03\u7528\u4f60\u5728view model\u91cc\u5b9a\u4e49\u7684\u65b9\u6cd5\u7684\u65f6\u5019\u53ef\u4ee5\u5f88\u5bb9\u6613\u518d\u8c03\u7528view model\u91cc\u5b9a\u4e49\u7684\u5176\u5b83\u5c5e\u6027\u3002\u4f8b\u5982\uff1a&nbsp;this.someOtherViewModelProperty\u3002<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u5f15\u7528\u5176\u5b83\u5bf9\u8c61\uff0c\u6211\u4eec\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a<\/p>\n<ul>\n<li>\u4f60\u53ef\u4ee5\u548c\u6ce81\u91cc\u90a3\u6837\u4f7f\u7528\u533f\u540d\u51fd\u6570\uff0c\u56e0\u4e3a\u5b83\u652f\u6301\u4efb\u610fJavaScript \u5bf9\u8c61\u3002<\/li>\n<li>\u4f60\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5f15\u7528\u4efb\u4f55\u51fd\u6570\u5bf9\u8c61\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528bind\u4f7fcallback\u51fd\u6570\u8bbe\u7f6ethis\u4e3a\u4efb\u4f55\u4f60\u9009\u62e9\u7684\u5bf9\u8c61\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ul>\n<pre><code>&lt;div data-bind=\"event: { mouseover: someObject.someFunction.bind(someObject) }\"&gt;\n    Mouse over me\n&lt;\/div&gt;<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u662fC#\u6216Java\u5f00\u53d1\u4eba\u5458\uff0c\u4f60\u53ef\u4ee5\u7591\u60d1\u4e3a\u4ec0\u4e48\u6211\u4eec\u8fd8\u8981\u7528bind\u51fd\u6570\u5230\u4e00\u4e2a\u5bf9\u8c61\u60f3\uff0c\u7279\u522b\u662f\u50cf\u8c03\u7528someObject.someFunction\u3002 \u539f\u56e0\u662f\u5728JavaScript\u91cc\uff0c\u51fd\u6570\u81ea\u5df1\u4e0d\u662f\u7c7b\u7684\u4e00\u90e8\u5206\uff0c\u4ed6\u4eec\u5728\u5355\u72ec\u5b58\u5728\u7684\u5bf9\u8c61\uff0c\u6709\u53ef\u80fd\u591a\u4e2a\u5bf9\u8c61\u90fd\u5f15\u7528\u540c\u6837\u7684someFunction\u51fd\u6570\uff0c\u6240\u4ee5\u5f53\u8fd9\u4e2a\u51fd\u6570\u88ab\u8c03\u7528\u7684\u65f6\u5019\u5b83\u4e0d\u77e5\u9053\u8c01\u8c03\u7528\u7684\uff08\u8bbe\u7f6ethis\u7ed9\u8c01\uff09\u3002\u5728\u4f60bind\u4e4b\u524d\u8fd0\u884c\u65f6\u662f\u4e0d\u4f1a\u77e5\u9053\u7684\u3002KO\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u8bbe\u7f6ethis\u5bf9\u8c61\u662fview model\uff0c\u4f46\u4f60\u53ef\u4ee5\u7528bind\u8bed\u6cd5\u91cd\u5b9a\u4e49\u5b83\u3002<\/p>\n<p>\u5728\u6ce81\u91cc\u4f7f\u7528\u533f\u540d\u51fd\u6570\u7684\u65f6\u5019\u6ca1\u6709\u5177\u4f53\u7684\u8981\u6c42\uff0c\u56e0\u4e3aJavaScript\u4ee3\u7801 someObject.someFunction()\u5c31\u610f\u5473\u7740\u8c03\u7528someFunction\uff0c\u7136\u540e\u8bbe\u7f6ethis\u5230 someObject\u5bf9\u8c61\u4e0a\u3002<\/p>\n<p><strong>\u6ce85\uff1a\u9632\u6b62\u4e8b\u4ef6\u5192\u6ce1<\/strong><\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cKnockout\u5141\u8bb8event\u4e8b\u4ef6\u7ee7\u7eed\u5728\u66f4\u9ad8\u4e00\u5c42\u7684\u4e8b\u4ef6\u53e5\u67c4\u4e0a\u5192\u6ce1\u6267\u884c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684\u5143\u7d20\u548c\u7236\u5143\u7d20\u90fd\u7ed1\u5b9a\u4e86mouseover\u4e8b\u4ef6\uff0c\u90a3\u4e48\u5982\u679c\u4f60\u7684\u9f20\u6807\u5728\u8be5\u5143\u7d20\u79fb\u52a8\u7684\u65f6\u5019\u4e24\u4e2a\u4e8b\u4ef6\u90fd\u4f1a\u89e6\u53d1\u7684\u3002\u5982\u679c\u9700\u8981\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u989d\u5916\u7684\u7ed1\u5b9ayoureventBubble\u6765\u7981\u6b62\u5192\u6ce1\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>&lt;div data-bind=\"event: { mouseover: myDivHandler }\"&gt;\n    &lt;button data-bind=\"event: { mouseover: myButtonHandler }, mouseoverBubble: false\"&gt;\n        Click me\n    &lt;\/button&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cmyButtonHandler\u4f1a\u5148\u6267\u884c\uff0c\u7136\u540e\u4f1a\u5192\u6ce1\u6267\u884cmyDivHandler\u3002\u4f46\u4e00\u65e6\u4f60\u8bbe\u7f6e\u4e86mouseoverBubble\u4e3afalse\u7684\u65f6\u5019\uff0c\u5192\u6ce1\u4e8b\u4ef6\u4f1a\u88ab\u7981\u6b62\u3002<\/p>\n<p><strong>\u4f9d\u8d56\u6027<\/strong><\/p>\n<p>\u9664KO\u6838\u5fc3\u7c7b\u5e93\u5916\uff0c\u65e0\u4f9d\u8d56\u3002<\/p>\n<h2>9&nbsp;&nbsp; submit \u7ed1\u5b9a<\/h2>\n<p><strong>\u76ee\u7684<\/strong><\/p>\n<p>submit\u7ed1\u5b9a\u5728form\u8868\u5355\u4e0a\u6dfb\u52a0\u6307\u5b9a\u7684\u4e8b\u4ef6\u53e5\u67c4\u4ee5\u4fbf\u8be5form\u88ab\u63d0\u4ea4\u7684\u65f6\u5019\u6267\u884c\u5b9a\u4e49\u7684JavaScript \u51fd\u6570\u3002\u53ea\u80fd\u7528\u5728\u8868\u5355form\u5143\u7d20\u4e0a\u3002<\/p>\n<p>\u5f53\u4f60\u4f7f\u7528submit\u7ed1\u5b9a\u7684\u65f6\u5019\uff0c Knockout\u4f1a\u963b\u6b62form\u8868\u5355\u9ed8\u8ba4\u7684submit\u52a8\u4f5c\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u6d4f\u89c8\u5668\u4f1a\u6267\u884c\u4f60\u5b9a\u4e49\u7684\u7ed1\u5b9a\u51fd\u6570\u800c\u4e0d\u4f1a\u63d0\u4ea4\u8fd9\u4e2aform\u8868\u5355\u5230\u670d\u52a1\u5668\u4e0a\u3002\u53ef\u4ee5\u5f88\u597d\u5730\u89e3\u91ca\u8fd9\u4e2a\uff0c\u4f7f\u7528submit\u7ed1\u5b9a\u5c31\u662f\u4e3a\u4e86\u5904\u7406view model\u7684\u81ea\u5b9a\u4e49\u51fd\u6570\u7684\uff0c\u800c\u4e0d\u662f\u518d\u4f7f\u7528\u666e\u901a\u7684HTML form\u8868\u5355\u3002\u5982\u679c\u4f60\u8981\u7ee7\u7eed\u6267\u884c\u9ed8\u8ba4\u7684HTML form\u8868\u5355\u64cd\u4f5c\uff0c\u4f60\u53ef\u4ee5\u5728\u4f60\u7684submit\u53e5\u67c4\u91cc\u8fd4\u56detrue\u3002<\/p>\n<p><strong>\u4f8b\u5b50<\/strong><\/p>\n<pre><code>&lt;form data-bind=\"submit: doSomething\"&gt;\n    ... form contents go here ...\n    &lt;button type=\"submit\"&gt;Submit&lt;\/button&gt;\n&lt;\/div&gt;\n\n&lt;script type=\"text\/javascript\"&gt;\n    var viewModel = {\n        doSomething: function (formElement) {\n            \/\/ ... now do something\n        }\n    };\n&lt;\/script&gt;<\/code><\/pre>\n<p>\u8fd9\u4e2a\u4f8b\u5b50\u91cc\uff0cKO\u5c06\u628a\u6574\u4e2aform\u8868\u5355\u5143\u7d20\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u5230\u4f60\u7684submit\u7ed1\u5b9a\u51fd\u6570\u91cc\u3002 \u4f60\u53ef\u4ee5\u5ffd\u7565\u4e0d\u7ba1\uff0c\u4f46\u662f\u6709\u4e9b\u4f8b\u5b50\u91cc\u662f\u5426\u6709\u7528\uff0c\u53c2\u8003\uff1ako.postJson\u5de5\u5177\u3002<\/p>\n<p><strong>\u4e3a\u4ec0\u4e48\u4e0d\u5728submit\u6309\u94ae\u4e0a\u4f7f\u7528click\u7ed1\u5b9a\uff1f<\/strong><\/p>\n<p>\u5728form\u4e0a\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528click\u7ed1\u5b9a\u4ee3\u66ffsubmit\u7ed1\u5b9a\u3002\u4e0d\u8fc7submit\u53ef\u4ee5handle\u5176\u5b83\u7684submit\u884c\u4e3a\uff0c\u6bd4\u5982\u5728\u8f93\u5165\u6846\u91cc\u8f93\u5165\u56de\u8f66\u7684\u65f6\u5019\u53ef\u4ee5\u63d0\u4ea4\u8868\u5355\u3002<\/p>\n<p><strong>\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<strong>\u4e3b\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp; \u4f60\u7ed1\u5b9a\u5230submit\u4e8b\u4ef6\u4e0a\u7684\u51fd\u6570<\/p>\n<p>&nbsp;&nbsp;&nbsp; \u4f60\u53ef\u4ee5\u58f0\u660e\u4efb\u4f55JavaScript\u51fd\u6570 \u2013 \u4e0d\u4e00\u5b9a\u975e\u8981\u662fview model\u91cc\u7684\u51fd\u6570\u3002\u4f60\u53ef\u4ee5\u58f0\u660e\u4efb\u610f\u5bf9\u8c61\u4e0a\u7684\u4efb\u4f55\u51fd\u6570\uff0c\u4f8b\u5982\uff1a&nbsp;submit: someObject.someFunction\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp; View model\u4e0a\u7684\u51fd\u6570\u5728\u7528\u7684\u65f6\u5019\u6709\u4e00\u70b9\u70b9\u7279\u6b8a\uff0c\u5c31\u662f\u4e0d\u9700\u8981\u5f15\u7528\u5bf9\u8c61\u7684\uff0c\u76f4\u63a5\u5f15\u7528\u51fd\u6570\u672c\u8eab\u5c31\u884c\u4e86\uff0c\u6bd4\u5982\u76f4\u63a5\u5199submit: doSomething\u5c31\u53ef\u4ee5\u4e86\uff0c\u800c\u65e0\u9700\u5199\u6210\uff1a&nbsp;submit: viewModel. doSomething\uff08\u5c3d\u7ba1\u662f\u5408\u6cd5\u7684\uff09\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp;<strong>\u5176\u5b83\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u65e0<\/p>\n<p><strong>\u5907\u6ce8\uff1a<\/strong><\/p>\n<p>\u5173\u4e8e\u5982\u679c\u4f20\u9012\u66f4\u591a\u7684\u53c2\u6570\u7ed9submit\u7ed1\u5b9a\u51fd\u6570\uff0c\u6216\u8005\u5f53\u8c03\u7528\u975eview model\u91cc\u7684\u51fd\u6570\u7684\u65f6\u5982\u4f55\u63a7\u5236this\uff0c\u8bf7\u53c2\u8003click\u7ed1\u5b9a\u3002\u6240\u6709click\u7ed1\u5b9a\u76f8\u5173\u7684notes\u4e5f\u90fd\u9002\u7528\u4e8esubmit\u7ed1\u5b9a\u3002<\/p>\n<p><strong>\u4f9d\u8d56\u6027<\/strong><\/p>\n<p>\u9664KO\u6838\u5fc3\u7c7b\u5e93\u5916\uff0c\u65e0\u4f9d\u8d56\u3002<\/p>\n<h2>10 &nbsp; enable \u7ed1\u5b9a<\/h2>\n<p><strong>\u76ee\u7684<\/strong><\/p>\n<p>enable\u7ed1\u5b9a\u4f7fDOM\u5143\u7d20\u53ea\u6709\u5728\u53c2\u6570\u503c\u4e3a true\u7684\u65f6\u5019\u624denabled\u3002\u5728form\u8868\u5355\u5143\u7d20input\uff0cselect\uff0c\u548ctextarea\u4e0a\u975e\u5e38\u6709\u7528\u3002<\/p>\n<p><strong>\u4f8b\u5b50<\/strong><\/p>\n<pre><code>&lt;p&gt;\n    &lt;input type='checkbox' data-bind=\"checked: hasCellphone\"\/&gt;\n    I have a cellphone\n&lt;\/p&gt;\n\n&lt;p&gt;\n    Your cellphone number:\n    &lt;input type='text' data-bind=\"value: cellphoneNumber, enable: hasCellphone\"\/&gt;\n&lt;\/p&gt;\n\n&lt;script type=\"text\/javascript\"&gt;\n    var viewModel = {\n        hasCellphone: ko.observable(false),\n        cellphoneNumber: \"\"\n    };\n&lt;\/script&gt;<\/code><\/pre>\n<p>\u8fd9\u4e2a\u4f8b\u5b50\u91cc\uff0c\u201cYour cellphone number\u201d\u540e\u7684text box \u521d\u59cb\u60c5\u51b5\u4e0b\u662f\u7981\u7528\u7684\uff0c\u53ea\u6709\u5f53\u7528\u6237\u70b9\u51fb\u6807\u7b7e \u201cI have a cellphone\u201d\u7684\u65f6\u5019\u624d\u53ef\u7528\u3002<\/p>\n<p><strong>\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<strong>\u4e3b\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp; \u58f0\u660eDOM\u5143\u7d20\u662f\u5426\u53ef\u7528enabled\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp; \u975e\u5e03\u5c14\u503c\u4f1a\u88ab\u89e3\u6790\u6210\u5e03\u5c14\u503c\u3002\u4f8b\u59820\u548cnull\u88ab\u89e3\u6790\u6210false\uff0c21\u548c\u975enull\u5bf9\u8c61\u88ab\u89e3\u6790\u7ed9true\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp; \u5982\u679c\u4f60\u7684\u53c2\u6570\u662fobservable\u7684\uff0c\u90a3\u7ed1\u5b9a\u4f1a\u968f\u7740observable\u503c\u7684\u6539\u53d8\u800c\u81ea\u52a8\u66f4\u65b0enabled\/disabled\u72b6\u6001\u3002\u5982\u679c\u4e0d\u662f\uff0c\u5219\u53ea\u4f1a\u8bbe\u7f6e\u4e00\u6b21\u5e76\u4e14\u4ee5\u540e\u4e0d\u518d\u66f4\u65b0\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;<strong>\u5176\u5b83\u53c2\u6570<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\u65e0<\/p>\n<p><strong>\u6ce8\uff1a\u4efb\u610f\u4f7f\u7528JavaScript\u8868\u8fbe\u5f0f<\/strong><\/p>\n<p>\u4e0d\u7d27\u7d27\u9650\u5236\u4e8e\u53d8\u91cf \u2013 \u4f60\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55JavaScript\u8868\u8fbe\u5f0f\u6765\u63a7\u5236\u5143\u7d20\u662f\u5426\u53ef\u7528\u3002\u4f8b\u5982,<\/p>\n<pre><code>&lt;button data-bind=\"enabled: parseAreaCode(viewModel.cellphoneNumber()) != '555'\"&gt;\n    Do something\n&lt;\/button&gt;<\/code><\/pre>\n<p><strong>\u4f9d\u8d56\u6027<\/strong><\/p>\n<p>\u9664KO\u6838\u5fc3\u7c7b\u5e93\u5916\uff0c\u65e0\u4f9d\u8d56\u3002<\/p>\n<h2>11 &nbsp; disable \u7ed1\u5b9a<\/h2>\n<p><strong>\u76ee\u7684<\/strong><\/p>\n<p>disable\u7ed1\u5b9a\u4f7fDOM\u5143\u7d20\u53ea\u6709\u5728\u53c2\u6570\u503c\u4e3a true\u7684\u65f6\u5019\u624ddisabled\u3002\u5728form\u8868\u5355\u5143\u7d20input\uff0cselect\uff0c\u548ctextarea\u4e0a\u975e\u5e38\u6709\u7528\u3002<\/p>\n<p>disable\u7ed1\u5b9a\u548cenable\u7ed1\u5b9a\u6b63\u597d\u76f8\u53cd\uff0c\u8be6\u60c5\u8bf7\u53c2\u8003enable\u7ed1\u5b9a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>7&nbsp;&nbsp; click \u7ed1\u5b9a \u76ee\u7684 click\u7ed1\u5b9a\u5728DOM\u5143\u7d20\u4e0a\u6dfb\u52a0\u4e8b\u4ef6\u53e5\u67c4\u4ee5\u4fbf\u5143\u7d20\u88ab\u70b9\u51fb\u7684\u65f6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182398],"tags":[],"class_list":["post-191165","post","type-post","status-publish","format-standard","hentry","category-mini-program"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/191165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=191165"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/191165\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=191165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=191165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=191165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}