我已经有了一个成熟的 JavaScript 表单。我所需要的只是一个简单的标签,哈哈。
它使用了之前的代码,但希望这个片段将有助于了解发生了什么:
export default class NewEvent extends FormStep {
get inputs() {
return [{
name: 'department',
label: 'Department / Specific Ministry'
}, {
name: 'title'
}, {
name: 'description',
type: 'textarea'
}, {
name: 'checkboxApproved',
type: 'checkbox',
label: 'This copy is approved and is to be used as written.'
}, {
name: 'checkboxDetails',
type: 'checkbox',
label: 'These are the details! Please help me write a catchy description.'
}, {
name: 'location'
}, {
name: 'contactName',
label: 'Event Contact Name'
}, {
name: 'contactEmail',
label: 'Event Contact Email (required)'
}, {
name: 'contactPhone',
label: 'Event Contact Phone (optional)'
}, {
name: 'eventURL'
}, {
name: 'isNewHRock',
type: 'checkbox',
label: 'This event is a new event we\'ve never done at HRock.'
}, {
name: 'hasOccurred',
type: 'checkbox',
label: 'We\'ve had this event before, but it is not on a recurring schedule.'
}, {
name: 'needsRegistration',
type: 'checkbox',
label: 'We need to set up registration for this event.'
}, <EventPrice key = 'eventPrice' /> , <EventClassInfo key = 'eventClassInfo' /> , <EventDateTimeInfo key = 'eventDateTimeInfo' /> ]
}
}
无论如何,所有这些项目都显示为表单。正如他们应该的那样。但我想简单地在复选框之间添加一个标签。我创建了以下 screenshot我想补充的内容。
但是,到目前为止,每当我在其中添加 text
时,它都会破坏代码,或者它会显示在 textfield
中...
帮忙?
最佳答案
这是一个“输入”对象。解析该对象的函数正在用它创建所有输入,这就是为什么你会得到一个文本框。我认为这不是代码中执行此操作的正确位置。
关于javascript - 如何将文本添加到表单输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32596520/