KendoUI>Framework>MVVM>Bindings

HTML4属性绑定例子:

< img  id ="logo"  data-bind ="attr: { src: imageSource, alt: imageAlt }"   />
< script >
    
var  viewModel  =  kendo.observable({
        imageSource: 
" http://www.kendoui.com/image/kendo-logo.png " ,
        imageAlt: 
" Kendo Logo "
    });

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

绑定显示结果:

< img  id ="logo"  src ="http://www.kendoui.com/image/kendo-logo.png"  alt ="Kendo Logo" />

 

HTML5属性绑定例子:

< div  data-bind ="attr: { data-foo: fooValue, data-bar: barValue }" ></ div >
< script >
    
var  viewModel  =  kendo.observable({
        fooValue: 
" foo " ,
        barValue: 
" bar "
    });

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

 

你可能感兴趣的:(framework)