uniapp组件-uni-list-chat聊天列表

本文介绍了一个聊天列表UI组件的不同样式实现,包括圆/方头像显示分割线、带圆点的提示、自定义右侧内容、带通知角标的单头像及多头像聊天列表等。这些样式可通过设置属性轻松实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

一、圆/方头像且显示分割线

二、带圆点

三、自定义右侧内容

四、带通知角标的单头像聊天列表

五、带通知角标的多头像聊天列表


 

一、圆/方头像且显示分割线

<template>
	<view>
		<uni-section title="圆头像且显示分割线" type="line"></uni-section>
		<uni-list-chat
			:avatar-circle="true"
			title="张三"
			avatar="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
			note="圆头像且显示分割线.圆头像且显示分割线.圆头像且显示分割线.圆头像且显示分割线"
			time="2020.02.30 xxx"
			:clickable="false"
		/>
		<uni-list-chat
			title="张三"
			avatar="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
			note="方头像且显示分割线.方头像且显示分割线.方头像且显示分割线.方头像且显示分割线"
			time="2020.02.30 xxx"
			:clickable="false"
		/>
	</view>
</template>

二、带圆点

<template>
	<view>
		<uni-list :border="false">
			<uni-list-chat
				:avatar-circle="true"
				title="张三"
				avatar="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
				note="圆头像,带圆点且不显示分割线.圆头像,带圆点且不显示分割线."
				time="2020.02.30 xxx"
				:clickable="false"
				badge-positon="left"
				badge-text="dot"
			/>
			<uni-list-chat
				:avatar-circle="true"
				title="张三"
				avatar="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
				note="圆头像,带圆点且不显示分割线.圆头像,带圆点且不显示分割线."
				time="2020.02.30 xxx"
				:clickable="false"
				badge-positon="left"
				badge-text="dot"
				:badge-text="2"
			/>
		</uni-list>
	</view>
</template>

三、自定义右侧内容

<template>
	<view>
		<uni-list-chat
			title="张三"
			avatar="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
			note="自定义右侧内容.自定义右侧内容.自定义右侧内容.自定义右侧内容"
		>
			<view class="chat-custom-right">
				<text class="chat-custom-text">刚刚</text>
				<uni-icons type="star-filled" color="#999" size="18"></uni-icons>
			</view>
		</uni-list-chat>
	</view>
</template>

四、带通知角标的单头像聊天列表

<template>
	<view>
		<uni-list-chat
			title="单头像"
			avatar="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
			note="带通知角标的单头像聊天列表.带通知角标的单头像聊天列表."
			time="2020.02.30 xxx"
			:badge-text="2"
			:clickable="true"
			@click="onClick"
		/>
	</view>
</template>

<script>
export default {
	components: {},
	data() {
		return {};
	},
	methods: {
		onClick() {
			uni.showToast({
				title: '列表被点击'
			});
		}
	}
};
</script>

五、带通知角标的多头像聊天列表

<template>
	<view>
		<uni-list-chat
			title="多头像"
			avatar="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
			note="带通知角标的多头像聊天列表.带通知角标的多头像聊天列表."
			time="2020.02.30 xxx"
			:badge-text="2"
			:clickable="true"
			@click="onClick"
			:avatarList="avatarList"
		/>
	</view>
</template>
<script>
export default {
	data() {
		return {
			avatarList: [
				{url: '/static/logo.png'},
				{url: '/static/logo.png'},
				{url: '/static/logo.png'}
			]
		};
	},
	methods: {
		onClick() {
			uni.showToast({
				title: '列表被点击'
			});
		}
	}
};
</script>

 

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值