Meteor 如何在autoformjs中实现单选按钮
模式 } HTML页面:Meteor 如何在autoformjs中实现单选按钮,meteor,meteor-autoform,Meteor,Meteor Autoform,模式 } HTML页面: Color : { optional: true, autoform: { type: "select-radio", options: function () { return [ {label: "orange", value: orange}, {label: "blue", value: blue}, {label: "red", value: red} ]; } } {{> afForm
Color : {
optional: true,
autoform: {
type: "select-radio",
options: function () {
return [
{label: "orange", value: orange},
{label: "blue", value: blue},
{label: "red", value: red}
];
}
}
{{> afFormGroup name="Color" type="select-radio" }}
复选框按钮不显示,我做错了什么?您还需要一个模式字段类型。不仅仅是autoform字段。试试这个:
{{> afFormGroup name="Color" type="select-radio" options=options}}
另一个选择是这样做,如果你想节省一些打字(请原谅咖啡脚本)
你的html助手是错误的。实现这一目标的正确方法是
color:
type: String
allowedValues: ['Red', 'Blue', 'Orange']
autoform:
type: 'select-radio'
注意,我刚刚从原始代码中删除了“options=options”
{{> afFormGroup name="Color" type="select-radio" }}
{{> afFormGroup name="Color" type="select-radio" options=options}}