如何覆盖功能?
var volusion = (function ($) {
var volusionDocReadyMethods = [],
currentCartCount;
..
function itemCount(count) {
if (count === undefined) {
return currentCartCount;
} else {
currentCartCount = count;
$("[data-v-observable='cart-count']").text(count);
return count;
}
}
...
$(function () {
init();
});
return {
ready: volusionDocReady,
cart: {
itemCount: itemCount,
isObservingCount: isObservingCount,
anchor: cartAnchor,
hasAnchor: hasCartAnchor
}
};
} (jQuery));
以上功能是核心.js文件,不可编辑。在这里,我试图覆盖上面的功能,但不适合我。所以这里隐藏了跨度,如果count为0,否则启用跨度。
<div id="cartWrapper">
<span class="cartNum" id="custom_cart_count" data-v-observable="cart-count">0</span>
</div>
我试过这个但不适合我。你能帮帮我吗?