Skip to content

t-indexed

Indexed 索引列表

组件介绍

索引导航组件,用于显示索引列表,支持配置索引数据列表,通过Canvas绘制实现高性能渲染。

平台兼容

HarmonyH5AndroidiOS小程序UTS

基础用法

vue
<template>
  <view class="indexed-demo">
    <t-indexed :list="indexedList" @select="handleSelect"></t-indexed>
  </view>
</template>

<script setup>
const indexedList = ref([
  { letter: 'A', name: 'A组' },
  { id: '1', name: '安徽' },
  { id: '2', name: '澳门' },
  { letter: 'B', name: 'B组' },
  { id: '3', name: '北京' },
  { id: '4', name: '保定' },
  { letter: 'C', name: 'C组' },
  { id: '5', name: '重庆' },
  { id: '6', name: '长沙' },
  { letter: 'D', name: 'D组' },
  { id: '7', name: '大连' },
  { id: '8', name: '东莞' },
]);

function handleSelect(data) {
  console.log('选中:', data);
}
</script>

<style scoped>
.indexed-demo {
  height: 100vh;
}
</style>

Props

属性名类型默认值说明可选值
sizeString"medium"组件尺寸large, medium, small, mini
typeString"primary"组件类型info, primary, error, warning, success
disabledBooleanfalse组件是否禁用true, false
hoverBooleanfalse是否有点击效果true, false
pathString""点击组件后跳转的页面路径-
effectString"normal"组件显示主题normal, dark, light, plain
listArray[]数据源-

Events

事件名说明回调参数
select索引选中时触发当前选中的信息
click点击时触发-
transitionend动画结束时触发-
initFinished组件初始化完成触发组件的节点信息
touchstart触摸开始时触发触摸事件对象
touchend触摸结束时触发触摸事件对象
touchmove触摸移动时触发触摸事件对象
touchcancel触摸取消时触发触摸事件对象

数据结构

字段名类型说明
idString列表项的唯一标识
nameString列表项的显示名称
letterString索引字母,用于分组显示