mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-08-06 02:47:25 +08:00
- 将多个组件转换为 `<script setup>` 语法,提升可读性和性能 - 优化状态管理和事件处理逻辑,简化代码结构 - 更新样式和布局以适应新组件结构 - 添加新功能和修复已知问题,提升用户体验
79 lines
1.4 KiB
Vue
79 lines
1.4 KiB
Vue
<template>
|
|
<view class="u-time-line-item">
|
|
<view class="u-time-line-item__node" :style="nodeStyle">
|
|
<slot name="node">
|
|
<view class="u-time-line-item__dot" :style="{ backgroundColor: bgColor }"></view>
|
|
</slot>
|
|
</view>
|
|
<view class="u-time-line-item__content">
|
|
<slot name="content" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
|
|
const props = defineProps<{
|
|
nodeTop?: string | number
|
|
bgColor?: string
|
|
}>()
|
|
|
|
const nodeStyle = computed(() => {
|
|
if (props.nodeTop === '' || props.nodeTop === null || props.nodeTop === undefined) {
|
|
return {}
|
|
}
|
|
const top = typeof props.nodeTop === 'number' ? `${props.nodeTop}rpx` : props.nodeTop
|
|
return { top }
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.u-time-line-item {
|
|
display: flex;
|
|
flex-direction: row;
|
|
position: relative;
|
|
padding-bottom: 32rpx;
|
|
|
|
&:last-child {
|
|
padding-bottom: 0;
|
|
}
|
|
|
|
&__node {
|
|
position: relative;
|
|
width: 32rpx;
|
|
display: flex;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
z-index: 1;
|
|
}
|
|
|
|
&__dot {
|
|
width: 16rpx;
|
|
height: 16rpx;
|
|
border-radius: 50%;
|
|
background-color: #ddd;
|
|
}
|
|
|
|
&__content {
|
|
flex: 1;
|
|
padding-left: 12rpx;
|
|
}
|
|
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
left: 15rpx;
|
|
top: 0;
|
|
bottom: 0;
|
|
width: 1px;
|
|
background-color: #ddd;
|
|
}
|
|
|
|
&:last-child::before {
|
|
bottom: auto;
|
|
height: 16rpx;
|
|
}
|
|
}
|
|
</style>
|