我想在我的主干 Stickit 绑定(bind)中定义一个 anchor 标记 href,这样每当模型属性更新时,我的 anchor 标记的 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。
有什么方法可以在 Backbone Stickit 中做到这一点吗?
最佳答案
Backbone.StickIt 有详细记录。在您的情况下,您想要更新属性,因此您可以使用: https://nytimes.github.io/backbone.stickit/#attributes
关于javascript - 如何在主干stickit中绑定(bind)元素属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33940134/