From d94d98c464937eb3601e4415d3aaf12aae432c5b Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Tue, 17 Jan 2017 12:13:18 +0800 Subject: [PATCH] fixed #215 --- src/components/select/option.vue | 3 ++- test/routers/select.vue | 55 ++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/components/select/option.vue b/src/components/select/option.vue index 535e487..471f6a5 100644 --- a/src/components/select/option.vue +++ b/src/components/select/option.vue @@ -55,7 +55,8 @@ this.isFocus = false; }, queryChange (val) { - this.hidden = !new RegExp(val, 'i').test(this.searchLabel); + const parsedQuery = val.replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1'); + this.hidden = !new RegExp(parsedQuery, 'i').test(this.searchLabel); } }, compiled () { diff --git a/test/routers/select.vue b/test/routers/select.vue index 72ccf95..90b325d 100644 --- a/test/routers/select.vue +++ b/test/routers/select.vue @@ -1,24 +1,49 @@