Browse Source

实现了斑马线

xiaocao 9 tháng trước cách đây
mục cha
commit
929dc9b980
1 tập tin đã thay đổi với 43 bổ sung2 xóa
  1. 43 2
      src/pages/home.vue

+ 43 - 2
src/pages/home.vue

@@ -3,15 +3,24 @@
 		<uni-list>
 			<uni-list>
 				<!--				:to="`/pages/work/projectImage/projectImage?projectId=${item.projectId}&projectName=${encodeURIComponent(item.projectName)}`"-->
+				<!--				:style="index % 2 === 0 ? 'background-color: #f8fff8' : 'background-color: #f0fff0'"-->
 				<uni-list-item
-						v-for="item in projectList"
+						v-for="(item, index)  in projectList"
 						:key="item.projectId"
+						:class="['list-item', index % 2 === 0 ? 'even' : 'odd']"
 						:note="'完成时间: ' + formatDate(item.finishTime)"
 						:title="item.projectName"
 						clickable
 						@click="handleClick(item)"
+				>
 
-				></uni-list-item>
+					<template #footer>
+						<view class="item-footer">
+							<uni-icons color="#999" size="18" type="right"></uni-icons>
+						</view>
+					</template>
+
+				</uni-list-item>
 
 			</uni-list>
 		</uni-list>
@@ -69,4 +78,36 @@ function handleClick(item) {
 
 <style scoped>
 
+
+/* 需要添加穿透 */
+:deep(.list-item.even) .uni-list-item__container {
+	background-color: #f8fff8 !important;
+}
+
+:deep(.list-item.odd) .uni-list-item__container {
+	background-color: #f0fff0 !important;
+}
+
+/* 通用样式 */
+.list-item {
+	transition: all 0.3s;
+}
+
+/* 偶数行样式 */
+.list-item.even {
+	background-color: #f8f8f8; /* 浅灰色背景 */
+}
+
+/* 奇数行样式 */
+.list-item.odd {
+	background-color: #ffffff; /* 白色背景 */
+}
+
+/* 右侧箭头样式 */
+.item-footer {
+	display: flex;
+	align-items: center;
+	justify-content: flex-end;
+	padding-right: 10rpx;
+}
 </style>