Meteor autoform 删除星号表单单选选项

Meteor autoform remove asterisk form radio option

我有一个 select-radio-inline' 类型的自动表格。所需的星号显示在所有选项中。我想将其从单选框中删除。 如何实现?

架构:

name: {
  type: String,
  autoform: {
    type: 'select-radio-inline',
    label: "Sex",
    afFieldInput: {
      options: function() {
        return [{
          label: "male",
          value: "male"
        }, {
          label: "female",
          value: "female"
        }];
      }
    }
  }
}

您可以通过覆盖对应的CSS规则来隐藏星号,例如:

[data-required] label:after {
    content: '';
}

如果您只想隐藏 name 组的所有星号,您可以创建一个 div 来包装您的 AutoForm 元素,然后使用 div 的标识符作为父级选择器:

#name > [data-required] label:after {
    content: '';
}

如果您想保留标签的星号,而只是删除 name 组中单选选项的星号,您可以使用:

[data-schema-key="name"] label:after {
    content: '';
}

Read more about the data-required attribute in Meteor AutoForm.

这对我有用。

.form-group[data-required="true"] .af-radio-group label:after {
    content: "" !important;
}