概述除了上一篇列出的KO内置的绑定类型(如value、text等),你也可以创建自定义绑定。注册你的binding handlerko.bindingHandlers.yourBindingName = { init: function(element, valueAccess ...
概述
除了上一篇列出的KO内置的绑定类型(如value、text等),你也可以创建自定义绑定。
注册你的binding handler
ko.bindingHandlers.yourBindingName = { init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { // This will be called when the binding is first applied to an element // Set up any initial state, event handlers, etc. here }, update: function(element, valueAccessor, allBindings, viewModel, bindingContext) { // This will be called once when the binding is first applied to an element, // and again whenever any observables/computeds that are accessed change // Update the DOM element based on the supplied values here. }};
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:【Knockout】五、创建自定义绑定
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。