lighting-ui
Version:
A rich interaction, lightweight, high performance UI library based on Weex
96 lines (78 loc) • 3.25 kB
Markdown
# lc-indexlist
> An indexed list, can be navigated by index.
### 规则:
- Support to set up columns and group presentations.
- Basic component that`s often used in contact lists and city lists.
## [Demo](https://h5.m.taobao.com/trip/lc-indexlist/index.html?_wx_tpl=https%3A%2F%2Fh5.m.taobao.com%2Ftrip%2Flc-indexlist%2Fdemo%2Findex.native-min.js)【group、list】
<img src="https://gw.alipayobjects.com/zos/rmsportal/MQBwOrcmQyMwUwPppoPo.gif" width="240"/> <img src="https://gw.alipayobjects.com/zos/rmsportal/USnVdDeDTNIkrMomOOpO.gif" width="240"/> <img src="https://img.alicdn.com/tfs/TB1qK2USpXXXXbSXpXXXXXXXXXX-200-200.png" width="160"/>
## Code Example
```vue
<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>
<script>
const modal = weex.requireModule('modal');
import { LcIndexlist } from 'weex-ui';
import {datelist} from 'data.js'
export default {
components: { LcIndexlist },
data: () => ({
list: dataList,
showIndex: true,
hotListConfig: {
type: 'group',
title: 'hot',
list: dataList.hotList
},
cityLocationConfig: {
type: 'group',
title: 'location',
list: [{ name: 'hangzhou', isLocation: true }]
}
}),
methods: {
LcIndexlistItemClicked (e) {
console.log(e)
}
}
};
</script>
```
More details can be found in [here](https://github.com/alibaba/weex-ui/blob/master/example/indexlist/index.vue)
### API
| Prop | Type | Required | Default | Description |
|-------------|------------|--------|-----|-----|
| list | `Array` |`Y`| `[]` |data list (*1)|
| hot-list-config | `Object` | `N`|`{}` | hot list (*2) |
| city-location-config | `Object` | `N`|`{}` | special、positioning configuration (*3) |
| show-index | `Boolean` |`N`| `true` | whether to show index nav |
| only-show-list | `Boolean` | `N`|`false` | whether to only show list *4) |
| nav-style | `Object` |`N`| `{}` | index sidebar custom style |
- *1:The configuration items of the normal list, Detailed data format: [demo/data.js#L16](https://github.com/alibaba/weex-ui/blob/master/example/indexlist/data.js#L16)
- *2:Some index list need in front of the normal list shows a list of popular form ,Support `group`,`list` type, Detailed data format: [demo/data.js#L2](https://github.com/alibaba/weex-ui/blob/master/example/indexlist/data.js#L2):
```json
hotListConfig: {
type: 'group',
title: 'hot',
list: dataList.hotList
}
```
- *3:Added a `city-location-config` for setting location city.
```json
cityLocationConfig: {
type: 'group',
title: 'location',
list: [{ name: 'hangzhou', isLocation: true }]
}
```
- *4:Whether to only display list items, remove location, hot display, often used for search results display.
### Event
```
`@LcIndexlistItemClicked="LcIndexlistItemClicked"`
```