From 16e2e072f8bf5697697b30ae2ff85c43032d9582 Mon Sep 17 00:00:00 2001 From: AmyFoxFN Date: Mon, 18 Dec 2017 15:51:51 +0800 Subject: [PATCH] add shortcut property --- example/data/index-list.json | 3 ++- src/components/index-list/index-list.vue | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/example/data/index-list.json b/example/data/index-list.json index 111b2d71..ee42106a 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 dd2012bf..ef5228f1 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) }) } }, -- GitLab