Indexlist 索引列表 APP
该方法或组件支持移动端小程序调用
PC
该方法或组件支持桌面端小程序调用

可以通过索引列表自定义展示的索引字符列表。点击索引栏时,会自动跳转到对应的锚点位置。

引入方式

数字生活小程序工程中,不需要 import,直接使用组件标签即可。

import { Breadcrumbs } from '@21cnfe/vui'
Vue.component('Breadcrumbs', Breadcrumbs)

i

代码演示

基本用法 在 :pathes 中传入路径数组,@pathClick用于处理路径点击
<template>
<div class="page">
<div class="demoName">
<a class="icon" @click="$router.push({path:'/'})"></a>
<div class="comp-title">Indexlist</div>
</div>
<h3>使用方法</h3>
<Indexlist :list="list" :showAnchor="true" @listItemClick="handleListItemClick" />
</div>
</template>
<script>
const list = [
{
key: 'A',
value: 'A 开头的文案',
sublist: [
{ key: 'Alice', value: 'Alice' },
{ key: 'Area', value: 'Area' },
{ key: 'Android', value: 'Android'},
// ...
]
},
// ...
{
key: 'G',
value: 'G 开头的文案',
sublist: [
// ...
{ key: 'Gymini', value: 'Gymini' }
]
}
];
export default {
name: 'indexlistExample',
data () {
return {
list
}
},
methods: {
handleListItemClick (event, item) {
console.log(event, item)
this.$Toast.info({ content: item.value })
}
}
}
</script>

API

属性 说明 类型 默认值
list 列表项数组 Array(必需) []
showAnchor 是否显示侧边栏导航锚点 Boolean false, 默认不显示

Event

事件名称 说明 回调参数
listItemClick 列表项点击事件 path
  1. 1. Indexlist 索引列表 APP 该方法或组件支持移动端小程序调用 PC 该方法或组件支持桌面端小程序调用
    1. 1.1. 引入方式
    2. 1.2. 代码演示
    3. 1.3. API
    4. 1.4. Event