嗨,我的脚本中有这个表格, 我可以解析脚本中的高度和宽度等选项值, 或者让我在通过该脚本渲染后用jQuery设计它?
var form1 = new Backbone.Form({
schema: {
country: { type: 'Select', options: ['UK', 'USA'] },
city: { type: 'Select', options: cities.UK },
message: { type: 'Text'}
}
}).render();
答案 0 :(得分:2)
您可以使用fieldAttrs
属性为元素设置任何属性:
country: {
type: 'Select',
options: ['UK', 'USA'],
fieldAttrs: { style: "width: 400px; height: 30px;" }
}
或者,您可以使用fieldClass
属性提供CSS类,并使用常规样式表应用CSS规则:
country: {
type: 'Select',
options: ['UK', 'USA'],
fieldClass: 'country-select'
}
所有可用的架构属性都是documented here。