更新记录
1.0.0(2024-12-04)
下载此版本
发布
平台兼容性
uni-app
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| × |
√ |
√ |
√ |
√ |
- |
- |
- |
- |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
| √ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
其他
dl-textScroll
props属性
| 属性 |
类型 |
默认值 |
说明 |
| data |
dataItem[] |
[] |
要进行滚动的数组,支持异步获取 |
| dataItem[] |
String |
50rpx |
容器的高度 |
| time |
Number |
2500 |
滚动间隔时间(单位:毫秒)要大于 animationTime |
| animationTime |
Number |
300 |
滚动动画时间(单位:毫秒) |
dataItem说明
| 属性 |
类型 |
默认值 |
说明 |
| text |
String |
null |
必填;进行滚动的文本 |
| slotName |
String |
null |
非必填;插槽名称 |
| [key:string] |
Number |
null |
其他自定义参数 |
Events事件
| 属性 |
类型 |
说明 |
| select |
(row:dataItem,index:Number) => void |
点击某文本的回调事件 |
使用示例
<template>
<view>
<!-- 插槽使用 -->
<dl-textScroll :data="data" class="textScroll-container" @select="select">
<template #slotName1="{row}">
<view >
<text>{{row.text}}</text>
<text style="color: green;">{{row.value}}</text>
</view>
</template>
<template #slotName2="{row}">
<view>
<text>{{row.text}}</text>
<text style="color: red;">{{row.value}}</text>
</view>
</template>
<template #slotName3="{row}">
<view>
<text>{{row.text}}</text>
<text >{{row.value}}</text>
</view>
</template>
</dl-textScroll>
<!-- 简单使用 -->
<dl-textScroll :data="data2" :time="1000" class="textScroll-container"></dl-textScroll>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const data = ref([])
const data2 = ref([
{
text:'文本1'
},
{
text:'文本2'
},
{
text:'文本3'
},
])
setTimeout(()=>{
//异步获取 data
data.value = [
{text:'今日预约人数:',slotName:'slotName1',value:100,},
{text:'较昨日新增:',slotName:'slotName2',value:10,},
{text:'本月预约人数:',slotName:'slotName3',value:1000,},
]
},2000)
const select = (row,index) => {
uni.showToast({
title:`index:${index}`
})
}
</script>
<style lang="scss" scoped>
.textScroll-container{
background-color: #f8f7f8;
color: #333333;
padding: 20rpx;
}
</style>