我想在我的主干stickit绑定中定义一个锚标记href,这样每当模型属性更新时,我的锚标记的href会更新
像这样,
import string
def getAppStatus(appName):
# If objectName is blank, then the application is not running.
objectName = AdminControl.completeObjectName('type=Application,name='+ appName+',*')
if objectName == "":
appStatus = 'Stopped'
else:
appStatus = 'Running'
return appStatus
def appStatusInfo():
Apps=AdminApp.list().split(java.lang.System.getProperty("line.separator"))
print '============================'
print ' Status | Application '
print '============================'
# Print apps and their status
for x in Apps:
print "X value", x
print getAppStatus(x) + ' | ' + x
print '============================'
appStatusInfo()
目前,我正在做这样的事情:
bindings : {
".facebook-profile-icon('href')" : "facebook"
".twitter-profile-icon('href')" : "twitter"
}
这只是(可以理解)更新类的html而不是更新hrefs。
我有没有办法在骨干粘贴中做到这一点?
答案 0 :(得分:1)
Backbone.StickIt有很好的文档。在您的情况下,您想要更新属性,因此您可以使用: https://nytimes.github.io/backbone.stickit/#attributes