From a4dbafe3efb8772d20359a809b8c8c23c9df3f40 Mon Sep 17 00:00:00 2001 From: senta_mandutz Date: Tue, 2 Jul 2019 13:08:11 +0200 Subject: [PATCH] autocomplete fro tags working --- public/index.html | 21 ++++++++++++++++----- public/routes/msgCard.js | 5 ++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/public/index.html b/public/index.html index 1d07040..a93e932 100644 --- a/public/index.html +++ b/public/index.html @@ -102,7 +102,8 @@ @@ -205,16 +206,26 @@ el: '#api', data: function() { return{ - searchtext: "ipsum", + searchtext: "", selected: [], taglist: dat, }; }, + computed:{ + filteredDataArray() { + return this.taglist.filter((option) => { + return option + .toString() + .toLowerCase() + .indexOf(this.searchtext.toLowerCase()) >= 0 + }) + } + }, methods: { search: function() { - console.log("Searchtext: " +this.searchtext + tagArray); + console.log("Searchtext: " +this.searchtext.replace(/#/g,'')); $.ajax({ - url: "api/msg/search/" + this.searchtext, + url: "api/msg/search/" + this.searchtext.replace(/#/g, ''), method: "GET" }).done(jd => { // NICHT SO wg. Vue: _messagelist = jd; @@ -230,7 +241,7 @@ console.log("searching: err: " + e + f + g); }) }, - getFilteredTags(text) { + getFilteredTags(text) { this.taglist = dat.filter((option) => { return option .toString() diff --git a/public/routes/msgCard.js b/public/routes/msgCard.js index 00ea8f6..b610b06 100644 --- a/public/routes/msgCard.js +++ b/public/routes/msgCard.js @@ -5,9 +5,8 @@ Vue.component('MsgCard', { {{ msg.message }}

-
- {{ tag }} -

+ #{{ tag }} +