分類  >  Web前端 >

3查的View & Controller binding

tags:    時間:2013-12-10 07:47:30
三查的View & Controller binding

帶著ROR的思想看三查,幾乎被看到了溝里,幾個彎始終拐不過來。比如,sancha似乎並不像ROR那樣默認通過名字來綁定V和C,具體是怎麼做的,我糾結了好久。今天寫程序的時候終於開了竅,總結規則如下:

 

    // The name of controller and view does not necessary to have any relationship, 

    // Essentially the controller does not bind to any "view", rather than bind to

    // certain UI element defined in refs, by using componentSelector

    //

    // So the MVC behavor of sencha is not exactly same as in ROR, which the name

    // of controller and view has kind of mapping by default

    //

    // And the most important thing here, is that:

    // WE ACTUALLY COULD BIND A DOM EVENT OF SINGLE VIEW TO MULTIPLE CONTROLLERS,

    // BY DEFINE THE SAME SELECTOR!

    // VICE VERSA, A SINGLE CONTROLLER COULD DEFINE SET OF HANDLERS FOR DOM EVENT

    // SITS IN MULTIPLE VIEWS!

推薦閱讀文章

Bookmark the permalink ,來源:互聯網