简体   繁体   English

有没有办法在手机屏幕上显示 antd datepicker 内联样式?

[英]Is there a way to show the antd datepicker inline style on mobile screen in react

I want to show the datepicker in inline style on mobile screen so that the datepicker should display full on mobile screeen using all the mobile screen width and should show normally on the desktop screen is there any way to do this我想在移动屏幕上以内联样式显示日期选择器,以便日期选择器应该使用所有移动屏幕宽度在移动屏幕上完整显示,并且应该在桌面屏幕上正常显示有没有办法做到这一点

I am new to the react that is why i am facing issues我对反应不熟悉,这就是我面临问题的原因

 `function ShowWithPopOver() { if(window.innerWidth>700) { } else { const el = document.getElementById('MobileDatePickerOverlay'); el.classList.add('mlk-drawer-open'); i want to show the datepicker in a div that will open before the datepicker will show } }` ` `
 <DatePicker placeholder='EndDate'onClick={ShowWithPopOver} onChange={onChange} name='EndDatePicker' id='EndDatePicker' style={{ border: "transparent", boxShadow: "none" }} />

You can use bootstrap for doing it.您可以使用 bootstrap 来完成它。 It will adjust the component's width based on the screen size.它将根据屏幕尺寸调整组件的宽度。 You can define how much width a component should take for screen of a particular size.您可以定义组件对于特定尺寸的屏幕应占用多少宽度。 Suppose your component is假设你的组件是

                            <dateTimePicker>Date<dateTimePicker/>

you can simply do is this你可以简单地做这个

                    <dateTimePicker class="col-sm-12">Date<dateTimePicker/> 

which tells browser that if the site is opened in small device like mobile it should take full width of screen and no other component should be placed alongside it.它告诉浏览器,如果该站点在移动设备等小型设备中打开,它应该占据整个屏幕宽度,并且不应在其旁边放置其他组件。

You can use this tutorial for reference.您可以使用教程作为参考。 I hope this will help you我希望这能帮到您

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM