calling javascript on rendering views in BackBone js. post-render callback?

后端 未结 8 1646
粉色の甜心
粉色の甜心 2020-12-04 19:55

behold, a backbone view render call:

render: function() {
  $(this.el).html(this.template({title: \'test\'}));  //#1
  this.renderScatterChart();
  return th         


        
8条回答
  •  独厮守ぢ
    2020-12-04 20:38

    You could just do this (if renderSactterChart operates on a 'jQuery-ized' object):

    render: function() {
      this.$el.html(this.template({title: 'test'}));  //#1
      this.$el.renderScatterChart();
      return this;
    },
    

    (this is not the actual DOM element...)

提交回复
热议问题