我正在尝试将新模型添加到集合中(这次我没有保存到服务器,只是在内存中执行此操作).我有以下代码:
$(function () {
//Model
var Story = Backbone.Model.extend({
defaults: {
'title': 'This is the title',
'description': 'Description',
'points': 0
},
url: '/'
});
//Collection
var Stories = Backbone.Collection.extend({
model: Story,
url: '/'
});
//View
var BaseView = Backbone.View.extend({
el: $('#container'),
events: {
'click .inner': 'onClickInner'
},
onClickInner: function() {
this.options.x++;
this.story.set({
'title': 'This is my collection test ' + this.options.x,
'description' : 'this is the description'
});
this.stories.add(this.story);
this.render();
},
initialize: function () {
this.stories = new Stories();
this.story …
Run Code Online (Sandbox Code Playgroud) 我刚刚使用html5历史api和使用history.js库的'pushstate'构建了这个网站.
我提交了它被谷歌索引,但在我检查谷歌网站的结果后,我可以看到文本没有被抓取.
我在互联网上看过很多这样的例子......
有什么问题?