1.此为home组件:
import React from "react";
import Title from "./Title";
import TaskInput from "./TaskInput";
import TaskList from "./TaskList";
function Home() {
return (
<div className="h-screen w-screen bg-primaryGrey flex flex-col justify-center items-center mobile:px-3 mobile:py-3">
<Title />
<TaskInput />
<TaskList />
</div>
);
}
export default Home;
字符串
2.此为TaskList组件:
import React from "react";
import Task from "./Task";
function TaskList() {
return (
<div className="bg-green mobile:w-[75vw] mobile:h-[50vh] mobile:pt-3 flex flex-col items-center justify-start mobile:gap-1 overflow-auto">
<Task />
<Task />
<Task />
<Task />
<Task />
</div>
);
}
export default TaskList;
型
3.任务组件:
import React from "react";
function Task() {
return (
<div className="bg-secondGrey h-[10vh] w-[70vw] mobile:rounded-[4px] drop-shadow-md mobile:px-2 py-1 flex">
<div className="h-full w-[10vw] bg-black"></div>
<div className="h-full w-[50vw] bg-green"></div>
<div className="h-full w-[10vw] bg-black"></div>
</div>
);
}
export default Task;
型
我的问题是,是什么原因导致任务列表不能滚动?任务会根据任务列表的高度缩小。如何解决这个问题?
我试过chatGpt,但什么也没发生。
1条答案
按热度按时间h9a6wy2h1#
考虑通过
shrink-0
类将flex-shrink: 0
应用于<Task>
组件中的根<div>
。这将覆盖1
的默认值flex-shrink
,该值试图缩小主flex轴上元素的尺寸以适应。个字符