the5fire / backbonejs-learning-note Goto Github PK
View Code? Open in Web Editor NEWbackbonejs学习笔记更新版,使用backbone1.1.0
License: MIT License
backbonejs学习笔记更新版,使用backbone1.1.0
License: MIT License
建议代码段中加<meta charset="utf-8">
, 否则经常出现乱码,老师辛苦啦!
//生成一个新Todo的所有属性的字典
newAttributes: function() {
return {
content: this.input.val(),
order: Todos.nextOrder(),
done: false
};
},
跟着这个教程一路实践过来收获蛮多,这里先谢谢楼主
todos源码中有的时候用单引号(比如 this.listenTo(Todos, 'add', this.addOne);),有的时候用双引号(比如 events:{...}),我在实践代码的时候,按照自己的习惯全部使用了单引号,结果程序不能正常运行。请问backbone中单双引号的使用有什么要注意的么?
看了胡哥的目录,但是希望胡哥能把require.js 替换成sea.js .我们的产品也是用sea.js ;
最主要的原因是sea.js 是咋国人创造的。我们的产品也在使用,也确实比较好用。我不是来帮玉伯打广告啊,我也不认识他。
官方文档这样解释的:this.el can be resolved from a DOM selector string or an Element。
您一般都是用jQuery对象给el赋值,不知道合适不,是不是应该用DOM选择器表示的字符串或者元素,那$el应该对应的是jQuery对象吧
var searchView = new SearchView();
应该改为
var searchView = new SearchView({el: "#search_container"});
或者在SearchView
构造函数中加入el: "#search_container",
这个文件我找不到了在你的项目里,是删除了吗?
为什么todo 里面要toggle 方法,
TodoView 里面的toggleDone 方法也可以承担这样的功能啊,例如改成这样:
toggleDone:function(){
this.model.save({done: !this.model.get('done')});
},
网上翻来覆去就是那几个例子。看完也不知道如何组织略微大一点的项目,甚至连个项目分组列表分页都搞不明白,大师是否出一个真正实用的例子呢?而不是整天todo。。。todo。。。todo....
这样当name发生变化是;
<type 'exceptions.NameError'> at /todos/
global name 'json' is not defined
Python D:\download\web.py-0.37\web.py-0.37\server.py in GET, line 25
Web GET http://localhost:8080/todos/
json需要定义
后台开发使用的是 Node.js ,用Express 4 生成的一个项目, 页面的话是用默认的.ejs 而不是 .html
报错说 search_label is not defined , 请问有什么好的解决办法嘛?
Traceback (most recent call last):
File "D:\python 2.7.7\lib\site-packages\web\wsgiserver__init__.py", line 1245, in communicate
req.respond()
File "D:\python 2.7.7\lib\site-packages\web\wsgiserver__init__.py", line 775, in respond
self.server.gateway(self).respond()
File "D:\python 2.7.7\lib\site-packages\web\wsgiserver__init__.py", line 2020, in respond
for chunk in response:
File "D:\python 2.7.7\lib\site-packages\web\httpserver.py", line 247, in iter
self.start_response(self.status, self.headers)
File "D:\python 2.7.7\lib\site-packages\web\httpserver.py", line 302, in xstart_response
out = start_response(status, response_headers, *args)
File "D:\python 2.7.7\lib\site-packages\web\wsgiserver__init__.py", line 2058, in start_response
raise TypeError("WSGI response header value %r is not a byte string." % v)
TypeError: WSGI response header value u'text/css' is not a byte string.
本文中记录了自己在实践的时候,遇到的问题。
http://siberiawolf.com/backboneJS-demo/
//生成一个新Todo的所有属性的字典
newAttributes: function() {
return {
content: this.input.val(),
order: Todos.nextOrder(),
done: false
};
},
<ul id="world-list">
</ul>
建议把world-list 改成world_list,代码手抄下来,这个东西坑了好久。
http://127.0.0.1:8080,就会看到熟悉的helloworld,是不是超级简单。
这句渲染连起来了,建议修改下。
在 第四章 Backbonejs中的Router实践 中,我按照文章里的示例,自己进行尝试时发现:
如果 routes 中定义的路由规则是以 /
开头的,所有路由都会被 defaultRoute
这个方法拦截掉,而不会被规则指定的方法拦截处理
请问这个是什么问题呢?
第176行应为man1.get('name')
6.4 从模型下手
/**
基本的Todo模型,属性为:content,order,done。
*/
属性为title, order,done。
Backbone V1.1.2 必须依赖jquery吗?
我用requireJS加载,莫名的将jquery加载出来,项目中没有用到jquery。一直提示找不到jquery。
如题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.