Skip to content

Marquee (跑马灯)

canvas绘制 用于文本的滚动展示,常用于公告或提示信息。

支持平台

安卓ios鸿蒙web微信小程序

示例代码

html
<template>
	<t-page main-class="p-30">
		<t-card main-class="mb-30" title="Marquee 跑马灯" sub-title="canvas绘制 用于文本的滚动展示,常用于公告或提示信息。"></t-card>
		<t-marquee :list="list" :speed="0.5" main-class="tdr tdb mb-30"> </t-marquee>
		<t-button type="primary" @click="add">增加数据测试</t-button>
	</t-page>
</template>

<script setup>
	const list = ref<UTSJSONObject[][]>([
		[
			{
				x: 0,
				text: '1.张** 领取了500元',
				color: '#666',
				fontSize: 16,
			},
			{
				x: 170,
				text: '2022-8-18 20:00:00',
				color: '#ccc',
				fontSize: 16,
			}
		],
		[
			{
				x: 0,
				text: '2.李** 领取了400元',
				color: '#ff0000',
				fontSize: 16,
			},
			{
				x: 170,
				text: '2022-8-18 20:00:15',
				color: '#ff5c67',
				fontSize: 16,
			}
		],
		[
			{
				x: 0,
				text: '3.王** 领取了300元',
				color: '#666',
				fontSize: 16,
			},
			{
				x: 170,
				text: '2022-8-18 20:01:30',
				color: '#ccc',
				fontSize: 16,
			}
		],
		[
			{
				x: 0,
				text: '4.赵** 领取了600元',
				color: '#666',
				fontSize: 16,
			},
			{
				x: 170,
				text: '2022-8-18 20:02:45',
				color: '#ccc',
				fontSize: 16,
			}
		],
		[
			{
				x: 0,
				text: '5.刘** 领取了200元',
				color: '#666',
				fontSize: 16,
			},
			{
				x: 170,
				text: '2022-8-18 20:03:20',
				color: '#ccc',
				fontSize: 16,
			}
		]
	])
	function add() {
		list.value.push([
			{
				x: 0,
				text: '增加数据 领取了200元',
				color: '#666',
				fontSize: 16,
			},
			{
				x: 170,
				text: '2022-8-18 10:03:20',
				color: '#ccc',
				fontSize: 16,
			}
		])
	}
</script>

属性

名称类型默认值说明可选值
sizeStringmini组件尺寸large(大尺寸), medium(中尺寸), small(小尺寸), mini(迷你)
typeString""组件类型info(信息), primary(正常), error(错误), warning(警告), success(成功)
disabledBooleanfalse组件是否禁用false, true
stopBooleanfalse是否阻止事件冒泡(Tui统一写法处理事件冒泡)false, true
hoverBooleantrue是否有点击效果false, true
pathString""点击组件后跳转的页面路径,如果为空则响应点击事件,如果不为空则跳转页面不会响应单击事件。-
mainClassString""组件根节点的样式-
nativeClassString""组件根节点原生样式-
effectString"normal"组件显示主题normal(正常), dark(深色), light(浅色), plain(镂空)
speedNumber1滚动速度
lineHeightNumber30文本行高
loopBooleantrue是否循环
listUTSJSONObject[][]``滚动数据配置