style: 调整css布局/央视
This commit is contained in:
@@ -44,16 +44,55 @@ export default function Index() {
|
|||||||
// });
|
// });
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const CustomTest = () => {
|
||||||
|
return <View>自定义组件</View>;
|
||||||
|
};
|
||||||
|
|
||||||
const HomeCardItem = () => {
|
const HomeCardItem = () => {
|
||||||
return [
|
return [
|
||||||
{ cityName: "北京", imagePath: beijing },
|
{
|
||||||
{ cityName: "上海", imagePath: shanghai },
|
cityName: "北京",
|
||||||
{ cityName: "广州", imagePath: guangzhou },
|
imagePath: beijing,
|
||||||
{ cityName: "深圳", imagePath: shenzhen },
|
isCustom: false,
|
||||||
{ cityName: "深圳", imagePath: shenzhen },
|
customCom: "test",
|
||||||
{ cityName: "深圳", imagePath: shenzhen },
|
},
|
||||||
{ cityName: "深圳", imagePath: shenzhen },
|
// 双数插入
|
||||||
|
{
|
||||||
|
cityName: "上海",
|
||||||
|
imagePath: shanghai,
|
||||||
|
isCustom: true,
|
||||||
|
customCom: <CustomTest />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cityName: "上海",
|
||||||
|
imagePath: shanghai,
|
||||||
|
isCustom: false,
|
||||||
|
customCom: "test",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cityName: "上海",
|
||||||
|
imagePath: shanghai,
|
||||||
|
isCustom: true,
|
||||||
|
customCom: <CustomTest />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cityName: "广州",
|
||||||
|
imagePath: guangzhou,
|
||||||
|
isCustom: false,
|
||||||
|
customCom: "test",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cityName: "上海",
|
||||||
|
imagePath: shanghai,
|
||||||
|
isCustom: true,
|
||||||
|
customCom: <CustomTest />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cityName: "深圳",
|
||||||
|
imagePath: shenzhen,
|
||||||
|
isCustom: false,
|
||||||
|
customCom: "test",
|
||||||
|
},
|
||||||
].map((item, index) => {
|
].map((item, index) => {
|
||||||
return (
|
return (
|
||||||
// 设置自动换行
|
// 设置自动换行
|
||||||
@@ -61,6 +100,7 @@ export default function Index() {
|
|||||||
style={{ marginRight: index % 2 != 1 ? "10px" : "0px" }}
|
style={{ marginRight: index % 2 != 1 ? "10px" : "0px" }}
|
||||||
className="homeCardItem"
|
className="homeCardItem"
|
||||||
>
|
>
|
||||||
|
{!item.isCustom ? (
|
||||||
<View className="homeCard">
|
<View className="homeCard">
|
||||||
{/* 城市封面图片 */}
|
{/* 城市封面图片 */}
|
||||||
<Image
|
<Image
|
||||||
@@ -74,6 +114,9 @@ export default function Index() {
|
|||||||
src={item.imagePath}
|
src={item.imagePath}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
) : (
|
||||||
|
item.customCom
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -93,6 +136,7 @@ export default function Index() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="index">
|
<View className="index">
|
||||||
|
<View className="indexHome">
|
||||||
{/* 顶部 */}
|
{/* 顶部 */}
|
||||||
<View className="indexHeader">
|
<View className="indexHeader">
|
||||||
{/* 头像 */}
|
{/* 头像 */}
|
||||||
@@ -133,7 +177,7 @@ export default function Index() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="tabbbarDiv"></View>
|
<View className="tabbbarDiv"></View>
|
||||||
|
</View>
|
||||||
{/* 底部tabbar */}
|
{/* 底部tabbar */}
|
||||||
<View className="tabbbar">
|
<View className="tabbbar">
|
||||||
<AtTabBar
|
<AtTabBar
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
.index {
|
.index {
|
||||||
|
.indexHome {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
background-color: aquamarine;
|
background-color: aquamarine;
|
||||||
|
|
||||||
.indexHeader {
|
.indexHeader {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -42,16 +42,15 @@
|
|||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
// margin-left:20px;
|
// margin-left:20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.homeCardDiv {
|
.homeCardDiv {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: blue;
|
// background-color: blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
.tabbbarDiv {
|
.tabbbarDiv {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 140px;
|
height: 140px;
|
||||||
|
|||||||
Reference in New Issue
Block a user