el-date-picker width overflow browser issue

Original link: el-date-picker width overflow browser problem

Origin of the problem

<el-date-picker 
    v-model="Time" type="datetimerange"
    range-separator="至"
    start-placeholder="年/月/日 时:分:秒"
    end-placeholder="年/月/日 时:分:秒"
    format="YYYY/MM/DD HH:mm:ss"
    value-format="YYYY-MM-DD HH:mm:ss"  />

As can be seen from the figure above, el-date-pickerit exceeds the width of the browser, resulting in a scroll bar.

Solution

Use the properties of the component itself popper-classto add custom ones class.

<el-date-picker 
    v-model="Time" type="datetimerange"
    range-separator="至"
    start-placeholder="年/月/日 时:分:秒"
    end-placeholder="年/月/日 时:分:秒"
    format="YYYY/MM/DD HH:mm:ss"
    value-format="YYYY-MM-DD HH:mm:ss"
    popper-class="tzy-popper"  />
.tzy-popper{
    margin-left: -55px;
}

Guess you like

Origin blog.csdn.net/qq_41356250/article/details/131767672