在使用ReactJS选择下拉列表中的项目后,如何进行活动?
实际上,我正在使用Laravek API从事ReactJS项目。在下拉列表中选择项目后,我想更改字段的值。 这是一个景象:如果我选择例如,每个期间的合同租金价值应为444(222*2)等... [1]: https://i.sstatic.net/t58vk.png 这是我的代码:
<Row>
<Col sm='6' className='mb-1'>
<Label className='form-label' >Select Period</Label>
<select className='form-control'>
<option>Select Period
</option>
{periodList.map((item) => {
return (<option value='periodicity'>{item.periodicity}</option>
)
})
}
</select>
</Col>
{unit.map((item) =>
<Col sm='6' className='mb-1'>
<Label className='form-label'>
Contract Rent Per Period
</Label>
<Input type='text' value={item?.unit_rent_per_month} />
</Col> )}
<Col sm='6' className='mb-1'>
<Label className='form-label' for='compl_date'>
Date <span className='text-danger'>*</span>
</Label>
<Flatpickr
className='form-control'
value={date}
id='date'
/>
</Col>
{unit.map((item) =>
<Col sm='6' className='mb-1'>
<Label className='form-label'>
Contract Rent Per Period
</Label>
<Input type='text' value={item?.unit_rent_per_month} />
</Col> )}
</Row>
如果你们中的任何人都可以帮助我,我将非常感谢
actually I'm working on reactJs project with Laravek API. I want to change the value of a field after choosing a item on a dropdown List.
This an exemple : if I choose for example bimothly the value of Contract Rent Per Period Should be 444 (222*2) etc...
[1]: https://i.sstatic.net/t58vK.png
This is my code:
<Row>
<Col sm='6' className='mb-1'>
<Label className='form-label' >Select Period</Label>
<select className='form-control'>
<option>Select Period
</option>
{periodList.map((item) => {
return (<option value='periodicity'>{item.periodicity}</option>
)
})
}
</select>
</Col>
{unit.map((item) =>
<Col sm='6' className='mb-1'>
<Label className='form-label'>
Contract Rent Per Period
</Label>
<Input type='text' value={item?.unit_rent_per_month} />
</Col> )}
<Col sm='6' className='mb-1'>
<Label className='form-label' for='compl_date'>
Date <span className='text-danger'>*</span>
</Label>
<Flatpickr
className='form-control'
value={date}
id='date'
/>
</Col>
{unit.map((item) =>
<Col sm='6' className='mb-1'>
<Label className='form-label'>
Contract Rent Per Period
</Label>
<Input type='text' value={item?.unit_rent_per_month} />
</Col> )}
</Row>
I would be very thankful if anyone of you can help mee
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在标签上添加on Click,并与他们一起做您想要的
you can add onClick on your Label and do with them what your want