首页 > 代码库 > -_-#【Backbone】View
-_-#【Backbone】View
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="../../app-min.css"> <script src="../../jquery/jquery-1.10.2.js"></script> <script src="../underscore.js"></script> <script src="../backbone.js"></script> <script> var SearchView = Backbone.View.extend({ initialize: function() { console.log(‘init a SearchView‘) }, render: function(context) { var template = _.template($(‘#search_template‘).html(), context) $(this.el).html(template) }, events: { ‘click input[type=button]‘: ‘doSearch‘ }, doSearch: function(event) { console.log(‘search for ‘ + $(‘#search_input‘).val()) } }) var searchView = new SearchView({el: $(‘#search_container‘)}) searchView.render({search_label: ‘搜索渲染‘}) </script> <article class="content"> <pre>var SearchView = Backbone.View.extend({ initialize: function() { console.log(‘init a SearchView‘) }, render: function(context) { var template = _.template($(‘#search_template‘).html(), context) $(this.el).html(template) }, events: { ‘click input[type=button]‘: ‘doSearch‘ }, doSearch: function(event) { console.log(‘search for ‘ + $(‘#search_input‘).val()) }})var searchView = new SearchView({el: $(‘#search_container‘)})searchView.render({search_label: ‘搜索渲染‘})</pre> </article></body></html>
-_-#【Backbone】View
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。