Bug Type: Component
Environment
- Vue Version:
3.3.4
- Element Plus Version:
2.3.8
- Browser / OS:
Chrome 114.0.5735.133 / Ubuntu 22.04.2
- Build Tool:
Vite
Reproduction
Related Component
el-table
Reproduction Link
Element Plus Playground
Steps to reproduce
Create a div with display:flex
.
Inside that add an empty div and an <el-table>
with a large amount of content.
Apply flex: 1 1 auto
to the <el-table>
to make it take up the full page width.
What is Expected?
The table should fit the available space and resize accordingly as the window is resized.
What is actually happening?
On first load the table is sized correctly. As the window width grows the table gets larger. However, when the window width gets smaller the table remains the same size and the window gets a horizontal scrollbar.
Additional comments
Removing the display:flex
or setting flex-direction:column
makes the problem go away.
4条答案
按热度按时间flmtquvp1#
@mrchimp hey can you assign me this task?
k75qkfdt2#
I tried it and it seems to be caused by the css. When the width of an element under flex is set to 100%, and this element has a child element with a width like "180px", it is like being set with a ‘min-width’, and its value is the width of the child element.
Element Plus Playground
h5qlskok3#
try this:
x9ybnkn64#
try this:
Perfect! Tnx!