From 63538762bd44d057299096be57012016d55004e9 Mon Sep 17 00:00:00 2001 From: hackrobot Date: Mon, 23 Sep 2024 23:30:37 +0800 Subject: [PATCH] update --- src/pages/index/index.jsx | 10 +--------- src/pages/index/index.scss | 37 +++++++++++++++++-------------------- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index b89d888..5085064 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -46,6 +46,7 @@ const Index = () => { return ( + {/* 数组尽量是4的倍数 */} {[ @@ -57,15 +58,6 @@ const Index = () => { { a: 1, b: 2 }, { a: 1, b: 2 }, { a: 1, b: 2 }, - { a: 1, b: 2 }, - { a: 1, b: 2 }, - { a: 1, b: 2 }, - { a: 1, b: 2 }, - { a: 1, b: 2 }, - { a: 1, b: 2 }, - { a: 1, b: 2 }, - { a: 1, b: 2 }, - ].map((item, index) => { return ; })} diff --git a/src/pages/index/index.scss b/src/pages/index/index.scss index 33489df..fd2f219 100644 --- a/src/pages/index/index.scss +++ b/src/pages/index/index.scss @@ -2,36 +2,33 @@ font-size: 16px; padding: 20px; display: flex; - flex-direction: row; + flex-direction: column; + .up { + width: 100%; + height: 200px; + background-color: red; + margin-bottom: 20px; + } .items { - // width: 80%; - // height: 200px; - // background-color: yellow; display: flex; flex-direction: row; align-items: center; // justify-content: space-between; flex-wrap: wrap; gap: 20px; /* 设置元素之间的间隔 */ + // padding-left: 10px; /* 确保两侧固定边距 */ + // padding-right: 10px; background-color: aqua; + .item { - // min-width: 300px; - max-width: 350px; - width: 270px; - height: 300px; - flex-grow: 1; + flex-grow: 1; /* 自动增长填充空间 */ + flex-basis: 280px; /* 基本宽度为 300px,元素数量随可用空间调整 */ + max-width: 350px; /* 设置最大宽度 */ + // width: 100%; /* 确保可以响应式变化 */ + height: 258px; background-color: yellow; - // margin-right: 20px; - margin-bottom: 40px; + margin-bottom: 20px; + border-radius: 5%; } } - - .right { - width: 400px; - display: flex; - // flex: 1; - // width: 20%; - height: 100%; - background-color: red; - } }