小编Car*_*Dry的帖子

将新模型添加到主干集合中,而不是替换

我正在尝试将新模型添加到集合中(这次我没有保存到服务器,只是在内存中执行此操作).我有以下代码:

$(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)

javascript collections model backbone.js

4
推荐指数
1
解决办法
2万
查看次数

为什么这个网站使用html5 pushstate不是seo友好的?

我刚刚使用html5历史api和使用history.js库的'pushstate'构建了这个网站.

http://renovari.co.uk

我提交了它被谷歌索引,但在我检查谷歌网站的结果后,我可以看到文本没有被抓取.

我在互联网上看过很多这样的例子......

有什么问题?

javascript seo html5 history.js

-1
推荐指数
1
解决办法
2712
查看次数

标签 统计

javascript ×2

backbone.js ×1

collections ×1

history.js ×1

html5 ×1

model ×1

seo ×1