## flex-wrap flex-wrap 属性设置弹性容器中的子元素在主轴方向是单行(列)还是多行(列)显示,以及多行(列)显示时的堆叠方向。 ### uni-app x 兼容性 Web: 4.0; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61 ### App平台拍平(flatten)兼容性 @flatten_compatibility | Android(Vapor) | iOS(Vapor) | HarmonyOS(Vapor) | | :- | :- | :- | | 5.21 | 5.11 | 5.0 | ### 语法 ``` flex-wrap: nowrap | wrap | wrap-reverse; ``` ### 值限制 - enum ### flex-wrap 的属性值 | 名称 | 兼容性 | 描述 | | :- | :- | :- | | nowrap | Web: 4.0; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61 | flex 的元素被摆放到到一行,这可能导致 flex 容器溢出。cross-start 会根据 flex-direction 的值等价于 start 或 before。为该属性的默认值。 | | wrap | Web: 4.0; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61 | 换行,第一行在上方。 | | wrap-reverse | Web: 4.0; Android: 3.9; iOS: 4.11; HarmonyOS: 4.61 | 和 wrap 的行为一样,但是 cross-start 和 cross-end 互换。 | ### 默认值 @default-value `nowrap` ### 适用组件 @unix-tags - [view](/component/view.md) - [scroll-view](/component/scroll-view.md) - [list-item](/component/list-item.md) - [flow-item](/component/flow-item.md) - [swiper-item](/component/swiper-item.md) - [navigator](/component/navigator.md) ### 示例 示例为[hello uni-app x alpha分支](https://gitcode.com/dcloud/hello-uni-app-x/blob/prod_alpha/pages/CSS/flex/flex-wrap.uvue),与最新HBuilderX Alpha版同步。与最新正式版同步的master分支示例[另见](https://gitcode.com/dcloud/hello-uni-app-x/blob/master//pages/CSS/flex/flex-wrap.uvue) ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/CSS/flex/flex-wrap > appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/CSS/flex/flex-wrap >示例 ```vue ``` ::: ### 参见 - [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-wrap) - [相关 Bug](https://issues.dcloud.net.cn/?mid=css.properties.flex.flex-wrap)