This commit is contained in:
parent
df56eb1a17
commit
08b475e84d
|
|
@ -7,6 +7,10 @@ const ImageGridSection = () => {
|
||||||
"/images/carousel-2.jpg",
|
"/images/carousel-2.jpg",
|
||||||
"/images/carousel-3.jpg"
|
"/images/carousel-3.jpg"
|
||||||
];
|
];
|
||||||
|
{/* 最外 左右两列间 内边 内容最大宽 水平居 微软雅黑
|
||||||
|
2 列+ 2 行 格子间距 固定宽高
|
||||||
|
*/}
|
||||||
|
|
||||||
const listItems = [
|
const listItems = [
|
||||||
'新闻标题一:重要政策发布',
|
'新闻标题一:重要政策发布',
|
||||||
'新闻标题二:经济数据稳步回升',
|
'新闻标题二:经济数据稳步回升',
|
||||||
|
|
@ -24,7 +28,8 @@ const ImageGridSection = () => {
|
||||||
fontFamily: 'Microsoft YaHei, sans-serif'
|
fontFamily: 'Microsoft YaHei, sans-serif'
|
||||||
}}>
|
}}>
|
||||||
|
|
||||||
{/* 左侧:3张图片 + 1个轮播图 2x2 网格 */}
|
{/* 左侧:3张图片 + 1个轮播图 2x2 网格 圆 防溢 拉伸填满
|
||||||
|
保持比例填充 消除底部空白*/}
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '1fr 1fr',
|
gridTemplateColumns: '1fr 1fr',
|
||||||
|
|
@ -32,9 +37,9 @@ const ImageGridSection = () => {
|
||||||
gap: '16px',
|
gap: '16px',
|
||||||
width: '600px',
|
width: '600px',
|
||||||
height: '450px',
|
height: '450px',
|
||||||
border: '1px solid #ddd', // 可选,用于调试边界
|
|
||||||
boxSizing: 'border-box' // 确保padding和border不会增加元素的实际宽度和高度
|
boxSizing: 'border-box' // 确保padding和border不会增加元素的实际宽度和高度
|
||||||
}}>
|
}}>
|
||||||
|
|
||||||
{elements.map((element, index) => (
|
{elements.map((element, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
|
|
@ -43,7 +48,7 @@ const ImageGridSection = () => {
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
boxShadow: '0 4px 10px rgba(0,0,0,0.1)',
|
boxShadow: '0 4px 10px rgba(0,0,0,0.1)',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'stretch' // 确保子元素拉伸填充容器
|
alignItems: 'stretch'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{typeof element === 'string' ? (
|
{typeof element === 'string' ? (
|
||||||
|
|
@ -58,7 +63,8 @@ const ImageGridSection = () => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
element // 如果是 React 元素,则直接渲染
|
element // 占据剩余空间 最小宽度;与左侧高度对齐;垂直布局;内容在垂直方向均匀分布
|
||||||
|
// 背景色、圆角、阴影、内边距 防撑大
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
@ -66,10 +72,10 @@ const ImageGridSection = () => {
|
||||||
<div style={{
|
<div style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: '300px',
|
minWidth: '300px',
|
||||||
height: '450px', // 设置与左侧相同的高度
|
height: '450px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
justifyContent: 'space-between', // 垂直方向均匀分布内容
|
justifyContent: 'space-between',
|
||||||
background: '#f9f9f9',
|
background: '#f9f9f9',
|
||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
||||||
|
|
@ -79,8 +85,8 @@ const ImageGridSection = () => {
|
||||||
<ul style={{
|
<ul style={{
|
||||||
listStyle: 'none',
|
listStyle: 'none',
|
||||||
padding: 0,
|
padding: 0,
|
||||||
flexGrow: 1, // 让列表尽可能填满可用空间
|
flexGrow: 1,
|
||||||
overflowY: 'auto' // 当内容超出时启用滚动条
|
overflowY: 'auto' // 当 内 容超出时启用滚动条 填满剩余 文间
|
||||||
}}>
|
}}>
|
||||||
{listItems.map((item, index) => (
|
{listItems.map((item, index) => (
|
||||||
<li
|
<li
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import { FhywPage } from "@/components/FireNews/fhyw";
|
||||||
import { FhjtPage } from "@/components/FireNews/fhjt";
|
import { FhjtPage } from "@/components/FireNews/fhjt";
|
||||||
import { FhwsPage } from "@/components/FireNews/fhws";
|
import { FhwsPage } from "@/components/FireNews/fhws";
|
||||||
import { FhrxPage } from "@/components/FireNews/fhrx";
|
import { FhrxPage } from "@/components/FireNews/fhrx";
|
||||||
|
import { AutoCarouselDemo } from "@/components/AutoCarousel";
|
||||||
export function meta( ) {
|
export function meta( ) {
|
||||||
return [
|
return [
|
||||||
{ title: "New React Router App" },
|
{ title: "New React Router App" },
|
||||||
|
|
@ -28,13 +29,12 @@ export default function Home() {
|
||||||
<NewsList />
|
<NewsList />
|
||||||
<ImageGridSection />
|
<ImageGridSection />
|
||||||
<GrassrootsDynamics />
|
<GrassrootsDynamics />
|
||||||
<GrassrootsDynamics />
|
|
||||||
<FhjtPage/>
|
<FhjtPage/>
|
||||||
<FhwsPage/>
|
<FhwsPage/>
|
||||||
<FhrxPage />
|
<FhrxPage />
|
||||||
|
<AutoCarouselDemo />
|
||||||
<CultureBgPage />
|
<CultureBgPage />
|
||||||
<Integrated />
|
<Integrated />
|
||||||
<Integrated />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue