From eca33681524d7047080c817d202d7b7d188634ea Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Mon, 22 May 2017 20:54:50 +0800 Subject: [PATCH] fix(render): find => filter --- src/core/render/index.js | 2 +- src/plugins/search/component.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/render/index.js b/src/core/render/index.js index 6c5581e4d..0b5dd805d 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -70,7 +70,7 @@ function renderNameLink (vm) { if (isPrimitive(vm.config.nameLink)) { el.setAttribute('href', nameLink) } else if (typeof nameLink === 'object') { - const match = Object.keys(nameLink).find(key => path.indexOf(key) > -1) + const match = Object.keys(nameLink).filter(key => path.indexOf(key) > -1)[0] el.setAttribute('href', nameLink[match]) } diff --git a/src/plugins/search/component.js b/src/plugins/search/component.js index 455314f97..66ddc5455 100644 --- a/src/plugins/search/component.js +++ b/src/plugins/search/component.js @@ -124,7 +124,7 @@ function updatePlaceholder (text, path) { if (typeof text === 'string') { $input.placeholder = text } else { - const match = Object.keys(text).find(key => path.indexOf(key) > -1) + const match = Object.keys(text).filter(key => path.indexOf(key) > -1)[0] $input.placeholder = text[match] } } @@ -133,7 +133,7 @@ function updateNoData (text, path) { if (typeof text === 'string') { NO_DATA_TEXT = text } else { - const match = Object.keys(text).find(key => path.indexOf(key) > -1) + const match = Object.keys(text).filter(key => path.indexOf(key) > -1)[0] NO_DATA_TEXT = text[match] } }