如何使用 knockoutjs 识别绑定到跨度的数据
how to identify data bind in to a span with knockoutjs
<span class="counter qty empty"
data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: getCartParam('summary_count') --><!-- ko text: getCartParam('summary_count') --><!-- /ko --><!-- /ko -->
<!-- ko ifnot: getCartParam('summary_count') --><!-- /ko -->
</span>
<span class="counter-label">
<!-- ko i18n: 'items' --><!-- /ko -->
</span>
</span>
span counter 通过 KnockoutJS 绑定一些数据! ,我需要知道范围内数据绑定前后的状态 ??
有一个 beforeChange
您可以在视图模型中订阅的事件:
myViewModel.counterObservable.subscribe(function(oldValue) {
alert("The counters's previous value is " + oldValue);
}, null, "beforeChange");
<span class="counter qty empty"
data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: getCartParam('summary_count') --><!-- ko text: getCartParam('summary_count') --><!-- /ko --><!-- /ko -->
<!-- ko ifnot: getCartParam('summary_count') --><!-- /ko -->
</span>
<span class="counter-label">
<!-- ko i18n: 'items' --><!-- /ko -->
</span>
</span>
span counter 通过 KnockoutJS 绑定一些数据! ,我需要知道范围内数据绑定前后的状态 ??
有一个 beforeChange
您可以在视图模型中订阅的事件:
myViewModel.counterObservable.subscribe(function(oldValue) {
alert("The counters's previous value is " + oldValue);
}, null, "beforeChange");