lc-indexlist

索引列表组件, 可以通过索引快速定位

注意事项

  • type为imgleft为左图右文结构,type为imgright为右图左文结构,type为text为纯文本结构。

效果

使用方法

<template>
<div class="container">
<lc-indexlist :normal-list="list.normalList"
:hot-list-config="hotListConfig"
:city-location-config="cityLocationConfig"
@LcIndexlistItemClicked="LcIndexlistItemClicked"
:show-index="showIndex"></lc-indexlist>
</div>
</template>

<style scoped>
.container {
width: 750px;
align-items: center;
}
</style>

<script>
import Light from 'light';
const modal = Light.requireModule('modal');
import LcIndexlist from 'lighting-ui/packages/lc-indexlist';
import dataList from 'indexlist';

export default {
components: { LcIndexlist },
data: () => ({
list: dataList,
showIndex: true,
hotListConfig: {
type: 'group',
title: '热门',
list: dataList.hotList
},
cityLocationConfig: {
type: 'group',
title: '定位',
list: [{ name: '杭州', isLocation: true }]
}
}),
methods: {
LcIndexlistItemClicked (e) {
modal.toast({ 'message': JSON.stringify(e.item), 'duration': 1 });
}
}
};
</script>

可配置参数

Prop Type Required Default Description
list Array Y [] 索引列表的数据项 (注1)
hot-list-config Object N {} 热门列表项目配置 (注2)
city-location-config Object N {} 特殊、城市定位逻辑配置 (注3)
show-index Boolean N true 是否显示索引
only-show-list Boolean N false 是否只显示列表 (注4)
nav-style Object N {} 索引侧边栏样式自定义
  • 注1:正常列表的配置项目,采用list的形式展示。
  • 注2:有些索引列表需要在正常列表前面展示一个热门列表,同时支持grouplist形式,整体配置为

    hotListConfig: {
    type: 'group',
    title: '热门',
    list: dataList.hotList
    }
  • 注3:特殊的城市列表需要展示定位逻辑,此处新增city-location-config配置,其他列表不需要配置,数据格式为,如果需要显示定位icon,传入isLocation

    cityLocationConfig: {
    type: 'group',
    title: '定位',
    list: [{ name: '杭州', isLocation: true }]
    }
  • 注4:是否只显示列表项目,去除定位、热门显示,常用于搜索结果的显示

事件回调

`@LcIndexlistItemClicked="LcIndexlistItemClicked"`