2011-02-10 77 views

回答

1

是的,这很容易。在你看来,你可以定义一个render()方法:

App.myView = SC.View.extend({ 

    render: function(context, firstTime) { 
    var someValue = `getValue` 

    context.push(
     "<span class='mySpan'>", someValue, "</span>", 
     "Any Other html/javascript that you want, can go here." 
    ); 

    } 

}) 

您还可以使用firstTime属性知道,如果你正在呈现第一次(放出来的一切),或者只是更新现有的代码。

你可以找到更多: