我不知道何时使用属性或函数。您能否详细解释一下 hasCellphone 在这里是一个函数还是属性?什么情况下它可以是属性或函数?我们应该使用什么?
启用:hasCellphone 还是
启用:hasCellphone(),为什么?
<input type='checkbox' data-bind="checked: hasCellphone" />
I have a cellphone
Your cellphone number:
<input type='text' data-bind="value: cellphoneNumber, enable: hasCellphone" />
<script type="text/javascript">
var viewModel = {
hasCellphone : ko.observable(false),
cellphoneNumber: ""
};
</script>