{"id":13654402,"url":"https://github.com/icindy/wxflex","last_synced_at":"2026-03-02T23:37:16.443Z","repository":{"id":75520552,"uuid":"71196122","full_name":"icindy/wxflex","owner":"icindy","description":"微信小程序的Flex布局demo－4种必备常用的Flex布局模式","archived":false,"fork":false,"pushed_at":"2016-10-18T01:46:00.000Z","size":78,"stargazers_count":223,"open_issues_count":0,"forks_count":53,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-08-20T22:46:57.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icindy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-10-18T01:25:11.000Z","updated_at":"2025-02-07T17:31:39.000Z","dependencies_parsed_at":"2023-06-06T17:45:21.759Z","dependency_job_id":null,"html_url":"https://github.com/icindy/wxflex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/icindy/wxflex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icindy%2Fwxflex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icindy%2Fwxflex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icindy%2Fwxflex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icindy%2Fwxflex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icindy","download_url":"https://codeload.github.com/icindy/wxflex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icindy%2Fwxflex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30025181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T23:36:48.274Z","status":"ssl_error","status_checked_at":"2026-03-02T23:33:36.569Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T03:00:31.842Z","updated_at":"2026-03-02T23:37:16.397Z","avatar_url":"https://github.com/icindy.png","language":"JavaScript","funding_links":[],"categories":["Demo","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# wxflex\n微信小程序的Flex布局demo－4种必备常用的Flex布局模式\n\n## 微信小程序开发论坛\n\n垂直微信小程序开发交流社区:[http://weappdev.com](http://weappdev.com)\n\n## 官方建议的Flex布局\n\n\u003e Flex的布局相比传统的float布局来说，简单、快捷、方便。掌握flex布局可以在制作微信小程序时减少wxss的代码，同时也符合微信小程序开发的文档要求\n\n本代码中涉及到四种Flex的布局方式，分别使用了不同的flex的不同属性。\n建议看本文最后的学习参考进行相关属性的学习\n\n\n## 骰子布局\n\n\u003e 骰子布局中主要强调几个属性的使用`display` `justify-content` `align-items` `align-self`等\n\n```\n.first-face {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n\n.second-face {\n  display: flex;\n  justify-content: space-between;\n}\n\n.second-pip-2 {\n  align-self: flex-end;\n}\n\n```\n\n\n![骰子布局截图](screenshoot/shaizi.png)\n\n\n\n## 网格布局\n\n\u003e 主要依赖flex属性\n\n```\n.Grid {\n  display: flex;\n}\n.Grid-cell {\n  flex: 1;\n}\n\n```\n\n![网格布局截图](screenshoot/grid.png)\n\n## 百分比布局\n\n```\n.Grid {\n  display: flex;\n}\n\n.cell-u-full {\n  flex: 0 0 100%;\n}\n\n```\n\n![百分比布局截图](screenshoot/perGrid.png)\n\n## 流式布局\n\n```\n.parent {\n  width: 100%;\n  background-color: black;\n  display: flex;\n  flex-flow: row wrap;\n  align-content: flex-start;\n}\n\n.child {\n  box-sizing: border-box;\n  background-color: white;\n  flex: 0 0 25%;\n  height: 50px;\n  border: 1px solid red;\n}\n\n```\n\n![流式布局截图](screenshoot/stream.png)\n\n## Flex 学习参考\n\n * 本代码参考[阮一峰的网络日志:Flex 布局教程：实例篇](http://www.ruanyifeng.com/blog/2015/07/flex-examples.html)编写\n\n * 语法学习 [阮一峰的网络日志:Flex 布局教程：语法篇](http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficindy%2Fwxflex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficindy%2Fwxflex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficindy%2Fwxflex/lists"}