gpt4 book ai didi

javascript - 在模态内居中对齐 react-datetime

转载 作者:行者123 更新时间:2023-11-28 01:34:27 25 4
gpt4 key购买 nike

我正在构建一个允许用户选择日期和时间的模式。我正在使用 react-datetime component .

这是我的代码:

<div className="date-time-modal">
<div className="date-time-modal-container">
<div className="date-time-modal-button">
<Button onClick={this.handleCloseModal} type="noborder">
<Icon name="window-close" size={"2x"} />
</Button>
</div>
<div className="date-time-modal-title">
"Please select date and time:"
</div>
<div className="date-time-modal-calendar">
<DateTime input={false} />
</div>
</div>
</div>

还有我的造型:

.date-time-modal {
position: fixed;
z-index: 1;
padding: 5%;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: $ux-theme-color-modal-brackground;
display: flex;
align-items: center;
justify-container: center;

}

.date-time-modal-container {
background-color: $ux-theme-color-template-header;
padding: 20px;

}

.date-time-modal-button {
flex: 1;
text-align: right;
}

.date-time-modal-title {
flex: 1;
text-align: left;
}

.date-time-modal-calendar {
flex: 1;
}

.date-time-modal-calendar * {
text-align: center;
}

每次打开模式时,日历都会锁定在左侧。如果我选择时间选择器,它就会堆叠起来。

在当前渲染下方(检查堆叠的时间选择器并全部左对齐):

enter image description here

enter image description here

我需要选择器以父级为中心,并且房屋选择器的行为正常(除了小时和分钟)。

最佳答案

我在 this post 得到了答案

必须使用 react-datetime css 文件正确设置组件的样式。

关于javascript - 在模态内居中对齐 react-datetime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50769436/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com