当前位置:网站首页>Invalid flex layout setting width

Invalid flex layout setting width

2022-06-13 08:36:00 webQiang99

There is a problem in the project today ,
 Insert picture description here
Part of the page is like this , Because it uses ant design mobile Component library , here
I just used ant In the component library flex Layout , But in ant Component library flex Layout , Not like grid layout , You can define the number of columns per row , Because in ant A row in the component library flex The number of columns in the layout is determined by <Flex.Item> The amount of the , Don't wrap ,
 Insert picture description here
You can see this attribute in the official website component library , So I want to give the width of each child element to the width of the parent element 33.33%, Set to wrap , It should be OK , But after setting up , Found set width It doesn't work , Later, step-by-step debugging was carried out , Found out where the problem is , It is because the child element sets a flex attribute ,flex:1 1,flex The expansion factor leads to width It doesn't work , So I wanted to flex The expansion factor of is set to 0, Is to put flex Set to flex:0 1 It should be OK , After setting, it still doesn't work , So find a solution on Baidu , So I found this article and solved the problem perfectly ,
flex Layout settings width Invalid
Set up flex:0 0 Width to be set ,
I still remember when I was in school , During the interview with Beisen cloud front end , There is a question like this :flex:1 0 Give a width , I forgot the specific width , Then let me talk about the final effect , No answer , Because it is usually used flex Generally, only one attribute is used , Other properties , Rarely used , I usually have problems , I will check Baidu myself , The specific usage of these attributes is rarely remembered , Sometimes I remember and understand , After a long time, I didn't use it very much , I forgot again , Today, I encountered such a problem , I still need to flex I'm looking at the properties .

原网站

版权声明
本文为[webQiang99]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270539565473.html