# TimeLine 时间轴

时间轴组件一般用于物流信息展示,各种跟时间相关的记录等场景。

# 平台差异说明

App H5 微信小程序 支付宝小程序 百度小程序 头条小程序 QQ小程序

# 基本使用

  • 该组件左边图标默认为显示一个点,如需自定义,请通过name为nodeslot传入内容
  • 组件右边内容为了更强的自定义,需要请通过name为contentslot传入

以下为示例代码

<template>
	<view class="wrap">
		<u-time-line :theme="theme">
			<u-time-line-item nodeTop="2">
				<template v-slot:node>
					<view class="u-node" style="background: #19be6b;">
						<u-icon name="pushpin-fill" color="#fff" :size="24"></u-icon>
					</view>
				</template>
				<template v-slot:content>
					<view>
						<view class="u-order-title">待取件</view>
						<view class="u-order-desc">[自提柜]您的快件已放在楼下侧门,直走前方53.6米,左拐约10步,再右拐直走,见一红灯笼停下,叩门三下,喊“芝麻开门”即可。</view>
						<view class="u-order-time">2019-05-08 12:12</view>
					</view>
				</template>
			</u-time-line-item>
			<u-time-line-item nodeTop="2">
				<template v-slot:node>
					<view class="u-node">
						<u-icon name="account-fill" color="#fff" :size="24"></u-icon>
					</view>
				</template>
				<template v-slot:content>
					<view>
						<view class="u-order-title unacive">派送中</view>
						<view class="u-order-desc">【深圳市】快件已到达目的地,派件员为国产锦衣卫007号,电话:<text class="tel">13833882438</text>,请留意快递信息</view>
						<view class="u-order-time">2019-05-08 06:03</view>
					</view>
				</template>
			</u-time-line-item>
			<u-time-line-item nodeTop="2">
				<template v-slot:node>
					<view class="u-node">
						<u-icon name="car-fill" color="#fff" :size="24"></u-icon>
					</view>
				</template>
				<template v-slot:content>
					<view>
						<view class="u-order-title unacive">运输中</view>
						<view class="u-order-desc">【深圳市】快递已到达 深圳固戍一部</view>
						<view class="u-order-time">2019-05-07 08:05</view>
					</view>
				</template>
			</u-time-line-item>
			<u-time-line-item>
				<template v-slot:content>
					<view>
						<view class="u-order-desc">【深圳市】快件已从深圳运转中心发出,正在发往深圳宝安一部</view>
						<view class="u-order-time">2019-12-06 22:30</view>
					</view>
				</template>
			</u-time-line-item>
			<u-time-line-item>
				<template v-slot:content>
					<view>
						<view class="u-order-desc">【深圳市】快件已到达 深圳运转中心</view>
						<view class="u-order-time">2019-12-04 16:42</view>
					</view>
				</template>
			</u-time-line-item>
			<u-time-line-item>
				<template v-slot:content>
					<view>
						<view class="u-order-desc">【郑州市】快件已从郑州运转中心出发,正在发往深圳运转中心</view>
						<view class="u-order-time">2019-12-02 12:55</view>
					</view>
				</template>
			</u-time-line-item>
			<u-time-line-item>
				<template v-slot:content>
					<view>
						<view class="u-order-desc">【郑州市】快件已到达 郑州运转中心</view>
						<view class="u-order-time">2019-12-02 08:23</view>
					</view>
				</template>
			</u-time-line-item>
			<u-time-line-item nodeTop="0">
				<template v-slot:node>
					<view class="u-node">
						<u-icon name="file-text-fill" color="#fff" :size="24"></u-icon>
					</view>
				</template>
				<template v-slot:content>
					<view>
						<view class="u-order-desc">您购买的商品【尚方宝剑,先斩后奏】,经由北京军区仓库发货,国内快递承运人【中南海保镖】。</view>
						<view class="u-order-time">2019-12-01 07:00</view>
					</view>
				</template>
			</u-time-line-item>
		</u-time-line>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				theme: 'normal',
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wrap {
		padding: 24rpx 24rpx 24rpx 40rpx;
	}

	.u-node {
		width: 44rpx;
		height: 44rpx;
		border-radius: 100rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #d0d0d0;
	}

	.u-order-title {
		font-weight: bold;
	}

	.u-order-desc {
		margin-bottom: 6rpx;
	}
</style>

# 注意事项

如果自定义了左边的图标等内容,有可能左边的图标无法和右边的内容平齐,可以调整time-line-item组件的node-top参数来达到想要的效果

<u-time-line-item node-top="2">
	<template v-slot:node>
		<u-icon name="pushpin-fill" color="#ddd" :size="24"></u-icon>
	</template>
	<template v-slot:content>
		......
	</template>
</u-time-line-item>

# API

# TiemLimeItem Props

参数 说明 类型 默认值 可选值
theme
FPI
主题模式,普通模式normal,关怀模式care String normal care
bg-color 左边节点的背景颜色,一般通过slot内容自定义背景颜色即可 String #ffffff -
node-top 节点左边图标绝对定位的top值,单位rpx String | Number - -