Kendo MVVM 数据绑定(七) Invisible/Visible

Kendo MVVM 数据绑定(七) Invisible/Visible

Invisible/Visible 绑定可以根据 ViewModel 的某个属性来显示/隐藏 DOM 元素。例如:

<div id="view">
    <div data-bind="invisible: isInvisible">some content

    </div>
     <button data-bind="click: show">Show</button>
</div>
<script>
    var viewModel = kendo.observable({
        isInvisible: true,
        show: function () {
            this.set("isInvisible", false);
        }
    });

    kendo.bind($("#view"), viewModel);
</script>

posted @ 2019-02-11 16:36  苗士军  阅读(261)  评论(0编辑  收藏  举报