indexList是基于原生js的索引列表组件,仅4kb,支持定制
无
<div class="indexlist">
<ul class="indexlist-content">
</ul>
<div class="indexlist-nav">
<ul class="indexlist-navlist">
</ul>
</div>
<div class="indexlist-indicator" style="display: none;" id="indicator"></div>
</div>
new IndexList({
el: document.querySelector('.indexlist'),
data: D.data,
indexRender: function (index) {
return '<p class="indexsection-index">' + index + '</p>';
},
itemRender: function (index, item) {
return '<a class="cell"><div class="cell-wrapper"><div class="cell-title"><span class="cell-text">' + item + '</span></div></div></a>'
}
})
[
{
index: 'A',
items: ['Aaron', 'Alden', 'Austin']
},
{
index: 'B',
items: ['Baldwin', 'Braden']
}
]