diff --git a/example/data/index-list.json b/example/data/index-list.json index 111b2d71551a53a722dd44bf92ef327bab2e3821..ee42106a74d4287ede3cfbe249f88114529917fa 100644 --- a/example/data/index-list.json +++ b/example/data/index-list.json @@ -1,6 +1,7 @@ [ { - "name": "★Hot City", + "name": "★ Hot City", + "shortcut": "★", "items": [ { "name": "BEIJING", diff --git a/src/components/index-list/index-list.vue b/src/components/index-list/index-list.vue index dd2012bf63729492d03ea44c60e9d9f43a8864c2..ef5228f1e89f63b6a81906c689ffd78b5aa63dba 100644 --- a/src/components/index-list/index-list.vue +++ b/src/components/index-list/index-list.vue @@ -40,11 +40,12 @@ import CubeScroll from '../scroll/scroll.vue' const COMPONENT_NAME = 'cube-index-list' - const EVENT_TITLE_CLICK = 'title-click' + /* eslint-disable no-unused-vars */ const EVENT_SELECT = 'select' // emit in index-list-item.vue - const ACTIVE_CLS = 'cube-index-list-item_active' + const EVENT_TITLE_CLICK = 'title-click' + const ACTIVE_CLS = 'cube-index-list-item_active' const ANCHOR_HEIGHT = window.innerHeight <= 480 ? 17 : 18 export default { @@ -95,7 +96,7 @@ }, shortcutList() { return this.data.map((group) => { - return group.name.substr(0, 1) + return group.shortcut || group.name.substr(0, 1) }) } },