当前位置: 首页 > 知识库问答 >
问题:

如何使react-day-picker更宽,以填充web应用移动版本中的所有屏幕

符献
2023-03-14

问题是我找不到一个适当的方法与CSS样式,使反应日选择器的宽度,足以填写所有的移动显示。

我尝试自定义react-day-picker提供的css文件,应用了很多样式,但都没有成功。


    .DayPicker {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        font-size: 2.5rem;
        margin: 0;
        margin-top: 2rem;
    }

    .DayPicker-wrapper {
        position: relative;
        flex-direction: row;
        user-select: none;
        width: 100%;
    }

    .DayPicker-Months {
        display: flex;
        flex-wrap: wrap;
        flex-direction: column;
    }

    .DayPicker-Month {
        display: table;
        margin: 0;
        margin-top: auto;
        border-spacing: 0;
        border-collapse: collapse;
        user-select: none;
    }

    .DayPicker-NavBar {
        position: relative;
    }

    .DayPicker-NavButton {
        position: absolute;
        top: 1.4rem;
        margin-top: 2px;
        width: 1.25em;
        height: 1.25em;
        background-position: center;
        background-size: 60%;
        background-repeat: no-repeat;
        color: #8B9898;
        cursor: pointer;
        outline: none;
    }

    .DayPicker-NavButton:hover {
        opacity: 0.8;
    }

    .DayPicker-NavButton--prev {
        left: 10px;
    }

    .DayPicker-NavButton--next {
        right: 10px;
    }

    .DayPicker-NavButton--interactionDisabled {
        display: none;
    }

    .DayPicker-Caption {
        display: table-caption;
        margin-bottom: 0;
        border: 1px solid #e9e9e9;
        padding: 0.5em 0.5em;
        background-color: #f1f1f1;
        text-align: center;
    }

    .DayPicker-Weekdays {
        display: table-header-group;
        margin-top: 1em;
    }

    .DayPicker-WeekdaysRow {
        display: none;
    }

    .DayPicker-Weekday {
        display: table-cell;
        padding: 0.5em;
        color: #8B9898;
        text-align: center;
        font-size: 0.875em;
    }


    .DayPicker-Body {
        display: table-row-group;
    }

    .DayPicker-Week {
    }

    .DayPicker-Day {
        display: table-cell;
        padding: 0.8em;
        border: 1px solid #d0d4d9;
        vertical-align: middle;
        text-align: center;
        cursor: pointer;
        width: 8.9vw;
    }

我想使日历足够宽,以填补我的网页应用程序(移动版本)的所有移动屏幕。

共有1个答案

党博超
2023-03-14

我不知道怎么做但我做到了。以下是解决方案:

.DayPicker {
    flex-direction: row;
    font-size: 2.5rem;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

.DayPicker-wrapper {
    position: relative;
    flex-direction: row;
    user-select: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

.DayPicker-Months {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.DayPicker-Month {
    display: table;
    margin: 0;
    padding: 0;
    margin-top: auto;
    border-spacing: 0;
    border-collapse: collapse;
    user-select: none;
}

.DayPicker-NavBar {
    position: relative;
    margin: 0;
    padding: 0;
}

.DayPicker-NavButton {
    position: absolute;
    top: 1.4rem;
    margin-top: 2px;
    width: 1.25em;
    height: 1.25em;
    background-position: center;
    background-size: 60%;
    background-repeat: no-repeat;
    color: #8B9898;
    cursor: pointer;
    outline: none;
}

.DayPicker-NavButton:hover {
    opacity: 0.8;
}

.DayPicker-NavButton--prev {
    left: 10px;
    background-image: url('../../images/navLeft.png');
}

.DayPicker-NavButton--next {
    right: 10px;
    background-image: url('../../images/navRight.png');}

.DayPicker-NavButton--interactionDisabled {
    display: none;
}

.DayPicker-Caption {
    display: table-caption;
    border: 1px solid #e9e9e9;
    padding: 0.5em 0.5em;
    background-color: #f1f1f1;
    text-align: center;
    margin: 0;
}

.DayPicker-Caption > div {
    font-family: "Open Sans", monospace;
    font-weight: 600;
    margin: 0;
    padding: 0;
}

.DayPicker-WeekdaysRow {
    display: none;
    margin: 0;
    padding: 0;
}

/*.DayPicker-Body {
    display: table-row-group;
}*/

.DayPicker-Week {
    display: table-row;
    margin: 0;
    padding: 0;
}

.DayPicker-Day {
    display: table-cell;
    padding: 0.8em;
    border: 1px solid #d0d4d9;
    vertical-align: middle;
    text-align: center;
    cursor: pointer;
    width: 6rem;
    margin: 0;
}


.DayPicker-TodayButton {
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    color: #4A90E2;
    font-size: 0.875em;
    cursor: pointer;
}
 类似资料:
  • 我正在用Java创建一个应用程序,它需要完成所有的监控屏幕。 我正在使用。setExtendedState(MAXIMIZED_BOTH),但它只满足工作空间。 我希望这个应用程序能像youtube视频一样,占据所有的屏幕。现在,当我打开应用程序时,它在右侧和顶部都有我的Linux菜单,但当我将应用程序移动到第二个监视器时,它会完成所有监视器屏幕。

  • 我需要使用jsp jstl在jsp中呈现所有java bean属性。我正在使用spring mvc。下面是Spring代码的一部分。 JSP JSTL代码: 实际上,POJO中有大约300个属性,手动编写类似属性非常繁琐。 我想要一些循环方式来获取所有属性值,这些属性值是使用jstl的jsp,或者可能是其他方式。请分享你的小贴士! 谢谢

  • 有没有方法(或快捷方式)填充查询的所有字段? 我们以https://graphql.org/swapi-graphql/为例。 但是如果我想填充所有字段(名称、高度等),该怎么办不需要手动输入?

  • ElementUI date-picker组件类型为时间范围时,在移动端上宽度超出屏幕宽度,应该如何设置? 在官网没有看到对弹出部分进行设置的相关说明

  • 问题内容: 我正在编写Web应用程序,并且想知道推荐的填充原始数据的方法是什么。这是JPA / Hibernate和Spring应用程序,由maven构建。到目前为止,我已经使用脚本将手工数据填充到数据库中,并填充了初始数据。 单元测试使用自己的数据,这些数据是在每次测试之前用代码创建的。我的测试类扩展了 org.springframework.test.jpa.AbstractJpaTests

  • 因此,我试图在我的JavaFX应用程序中创建一个自定义节点,它从扩展而来,因此可以自己进行渲染。我一开始只是试着画一个文本“Hello world”在画布上,但可惜它没有出现,即使我可以通过鼠标事件处理程序确认应用程序中是否存在自定义节点。 简而言之,如果我将这个的一个新实例添加到一个