Browse Source

first Try to autocomplete the search

master
Xenia Gruenzinger 5 years ago
parent
commit
5280c47477
1 changed files with 41 additions and 15 deletions
  1. 41
    15
      public/index.html

+ 41
- 15
public/index.html View File

<a class="logo-img" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a> <a class="logo-img" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a>
<form class="om-searchbar" @submit.prevent="search()"> <form class="om-searchbar" @submit.prevent="search()">
<b-field> <b-field>
<b-input
type="search"
v-model="searchtext"
icon="magnify"
placeholder="Suche...">
</b-input>
<!--<b-autocomplete
v-model="name"
:data="filteredTagArray"
type="search"
icon="magnify"
placeholder="Suche..."
@blur="evaluate">
</b-autocomplete>-->
<b-taginput
id="search-text"
type="search"
v-model="selected"
:data=taglist
autocomplete
allow-new:true
icon="magnify"
placeholder="suche.."
@typing="getFilteredTags"
@input="saveTagsToArray">
</b-taginput>
</b-field> </b-field>
</form> </form>
</div> </div>
</div> </div>


<script> <script>
var tagArray = [];
const data=[
'th',
'efi',
'wichtig',
];


const routes = [ const routes = [
{ path: "/", component: HomeRouter }, { path: "/", component: HomeRouter },
data: function() { data: function() {
return{ return{
searchtext: "ipsum", searchtext: "ipsum",
selected: [],
taglist: data,
}; };
}, },
methods: { methods: {
}).fail(function(e, f, g) { }).fail(function(e, f, g) {
console.log("searching: err: " + e + f + g); console.log("searching: err: " + e + f + g);
}) })
}
},
getFilteredTags(text) {
this.taglist = data.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
},
saveTagsToArray: function() {
tagArray = this.selected;
console.info(tagArray);
},
function get_insert_tag(id){
$.ajax({ url: "api/tag/"+id, method: "GET" }).done(function (tag) {
data.push("#"+tag.name);
console.log("it worked!");
}).fail(function (e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g);
})
},
}, },
mounted: function () { mounted: function () {
//this.search(); //this.search();

Loading…
Cancel
Save