From f75a861cc1ca8e4e793524eb84b2f494a078f113 Mon Sep 17 00:00:00 2001 From: hackrobot Date: Tue, 19 Mar 2024 17:38:39 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E8=B0=83=E6=95=B4css=E5=B8=83?= =?UTF-8?q?=E5=B1=80/=E5=A4=AE=E8=A7=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.jsx | 166 +++++++++++++++++++++++-------------- src/pages/index/index.scss | 91 ++++++++++---------- 2 files changed, 150 insertions(+), 107 deletions(-) diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index 732cdc7..924c0a9 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -44,16 +44,55 @@ export default function Index() { // }); }, []); + const CustomTest = () => { + return 自定义组件; + }; + const HomeCardItem = () => { return [ - { cityName: "北京", imagePath: beijing }, - { cityName: "上海", imagePath: shanghai }, - { cityName: "广州", imagePath: guangzhou }, - { cityName: "深圳", imagePath: shenzhen }, - { cityName: "深圳", imagePath: shenzhen }, - { cityName: "深圳", imagePath: shenzhen }, - { cityName: "深圳", imagePath: shenzhen }, - + { + cityName: "北京", + imagePath: beijing, + isCustom: false, + customCom: "test", + }, + // 双数插入 + { + cityName: "上海", + imagePath: shanghai, + isCustom: true, + customCom: , + }, + { + cityName: "上海", + imagePath: shanghai, + isCustom: false, + customCom: "test", + }, + { + cityName: "上海", + imagePath: shanghai, + isCustom: true, + customCom: , + }, + { + cityName: "广州", + imagePath: guangzhou, + isCustom: false, + customCom: "test", + }, + { + cityName: "上海", + imagePath: shanghai, + isCustom: true, + customCom: , + }, + { + cityName: "深圳", + imagePath: shenzhen, + isCustom: false, + customCom: "test", + }, ].map((item, index) => { return ( // 设置自动换行 @@ -61,19 +100,23 @@ export default function Index() { style={{ marginRight: index % 2 != 1 ? "10px" : "0px" }} className="homeCardItem" > - - {/* 城市封面图片 */} - - + {!item.isCustom ? ( + + {/* 城市封面图片 */} + + + ) : ( + item.customCom + )} ); }); @@ -93,47 +136,48 @@ export default function Index() { return ( - {/* 顶部 */} - - {/* 头像 */} - - {/* color="#F00" */} - - { - Taro.request({ - url: " http://172.19.0.1:8082/test", //仅为示例,并非真实的接口地址 - method: "POST", - data: { - openid: "111", - wxid: "22", - }, - header: { - "content-type": "application/json", // 默认值 - }, - success: function (res) { - console.log(res.data); - }, - }); - }} - > - 发起请求 - + + {/* 顶部 */} + + {/* 头像 */} + + {/* color="#F00" */} + + { + Taro.request({ + url: " http://172.19.0.1:8082/test", //仅为示例,并非真实的接口地址 + method: "POST", + data: { + openid: "111", + wxid: "22", + }, + header: { + "content-type": "application/json", // 默认值 + }, + success: function (res) { + console.log(res.data); + }, + }); + }} + > + 发起请求 + + + + {/* 省份标签 */} + + + + + {/* 城市列表 */} + + + + + - - {/* 省份标签 */} - - - - - {/* 城市列表 */} - - - - - - {/* 底部tabbar */}