ko.bindingHandlers是先执行init进行初始化数据的绑定(如果需要执行updata进行数据更新可以不用初始化);
1 init: function(element, valueAccessor) { 2 //初始化数据--然后执行updata进行需要更新数据的绑定,添加订阅 3 //如果在updata进行了数据的执行,init可以添加初始化事件 4 var value = valueAccessor(); // Get the current value of the current property we're bound to 5 $(element).text(value); // jQuery will hide/show the element depending on whether "value" or true or false 6 },