如何在主干stickit中绑定元素属性?

Posted

技术标签:

【中文标题】如何在主干stickit中绑定元素属性?【英文标题】:How to bind element attributes in backbone stickit? 【发布时间】:2015-11-26 13:37:46 【问题描述】:

我想在我的主干stickit绑定中定义一个锚标签href,这样每当模型属性更新时,我的锚标签的href就会更新

类似的,

bindings : 
    ".facebook-profile-icon('href')" : "facebook"
    ".twitter-profile-icon('href')" : "twitter"

目前,我正在做这样的事情:

bindings : 
    ".facebook-profile-icon" : "facebook"
    ".twitter-profile-icon" : "twitter"


render : function()
  this.stickit();

这只是(可以理解)更新类的 html 而不是更新 href。

有没有办法在骨干stickit中做到这一点?

【问题讨论】:

【参考方案1】:

Backbone.StickIt 有据可查。在您的情况下,您想更新属性,因此您可以使用: https://nytimes.github.io/backbone.stickit/#attributes

【讨论】:

以上是关于如何在主干stickit中绑定元素属性?的主要内容,如果未能解决你的问题,请参考以下文章