fixed createMessage/ files Tag autocomplete
This commit is contained in:
parent
d003166e33
commit
4aa5856fbc
@ -1,5 +1,4 @@
|
|||||||
var tagArray = [];
|
var tagArray = [];
|
||||||
const data=[];
|
|
||||||
const CreateMsgRouter = {
|
const CreateMsgRouter = {
|
||||||
template: `
|
template: `
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@ -18,12 +17,12 @@ const CreateMsgRouter = {
|
|||||||
<b-taginput
|
<b-taginput
|
||||||
id="tag"
|
id="tag"
|
||||||
v-model="selected"
|
v-model="selected"
|
||||||
:data=taglist
|
:data="filteredDataArray"
|
||||||
autocomplete
|
autocomplete
|
||||||
allow-new:false
|
allow-new:false
|
||||||
icon="label"
|
icon="label"
|
||||||
placeholder="#"
|
placeholder="#"
|
||||||
@typing="getFilteredTags"
|
|
||||||
@input="saveTagsToArray">
|
@input="saveTagsToArray">
|
||||||
</b-taginput>
|
</b-taginput>
|
||||||
</b-field>
|
</b-field>
|
||||||
@ -52,12 +51,12 @@ const CreateMsgRouter = {
|
|||||||
<b-taginput
|
<b-taginput
|
||||||
id="tag"
|
id="tag"
|
||||||
v-model="selected"
|
v-model="selected"
|
||||||
:data=taglist
|
:data="filteredDataArray"
|
||||||
autocomplete
|
autocomplete
|
||||||
allow-new:false
|
allow-new:false
|
||||||
icon="label"
|
icon="label"
|
||||||
placeholder="#"
|
placeholder="#"
|
||||||
@typing="getFilteredTags"
|
|
||||||
@input="saveTagsToArray">
|
@input="saveTagsToArray">
|
||||||
</b-taginput>
|
</b-taginput>
|
||||||
</b-field>
|
</b-field>
|
||||||
@ -77,9 +76,20 @@ const CreateMsgRouter = {
|
|||||||
auth: auth,
|
auth: auth,
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
selected: [],
|
selected: [],
|
||||||
|
searchtext : "",
|
||||||
taglist: data,
|
taglist: data,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed:{
|
||||||
|
filteredDataArray() {
|
||||||
|
return this.taglist.filter((option) => {
|
||||||
|
return option
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.indexOf(this.searchtext.toLowerCase()) >= 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
saveTagsToArray: function() {
|
saveTagsToArray: function() {
|
||||||
tagArray = this.selected;
|
tagArray = this.selected;
|
||||||
@ -153,17 +163,9 @@ const CreateMsgRouter = {
|
|||||||
userField.prop('disabled',false);
|
userField.prop('disabled',false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.list_tags();
|
//this.list_tags();
|
||||||
if ($(this).bootstrapMaterialDesign)
|
if ($(this).bootstrapMaterialDesign)
|
||||||
$(this).bootstrapMaterialDesign();
|
$(this).bootstrapMaterialDesign();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function get_insert_tag(id){
|
|
||||||
$.ajax({ url: "api/tag/id/"+id, method: "GET" }).done(function (tag) {
|
|
||||||
data.push("#" + tag.name);
|
|
||||||
console.log("Array:"+this.data);
|
|
||||||
}).fail(function (e, f, g) {
|
|
||||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
var isSearchActive = false,
|
var isSearchActive = false,
|
||||||
tagArray = ["lorem"];
|
tagArray = ["lorem"];
|
||||||
|
|
||||||
const dat=[
|
const data=[],
|
||||||
'th',
|
|
||||||
'efi',
|
|
||||||
'wichtig',
|
|
||||||
],
|
|
||||||
search_data = [];
|
search_data = [];
|
||||||
|
|
||||||
Vue.component('search',{
|
Vue.component('search',{
|
||||||
@ -27,7 +23,7 @@ Vue.component('search',{
|
|||||||
return{
|
return{
|
||||||
searchtext: "",
|
searchtext: "",
|
||||||
selected: [],
|
selected: [],
|
||||||
taglist: dat,
|
taglist: data,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
@ -42,7 +38,7 @@ Vue.component('search',{
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getFilteredTags(text) {
|
getFilteredTags(text) {
|
||||||
this.taglist = dat.filter((option) => {
|
this.taglist = data.filter((option) => {
|
||||||
return option
|
return option
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
@ -64,6 +60,7 @@ Vue.component('search',{
|
|||||||
$.ajax({url: "api/tag/ids", method: "GET"})
|
$.ajax({url: "api/tag/ids", method: "GET"})
|
||||||
.done(jd => {
|
.done(jd => {
|
||||||
// NICHT SO wg. Vue: _messagelist = jd;
|
// NICHT SO wg. Vue: _messagelist = jd;
|
||||||
|
if(data == ""){
|
||||||
_taglist.splice(0, _taglist.length);
|
_taglist.splice(0, _taglist.length);
|
||||||
_taglist.push.apply(_taglist, jd);
|
_taglist.push.apply(_taglist, jd);
|
||||||
// console.log("tag: jd: " + jd);
|
// console.log("tag: jd: " + jd);
|
||||||
@ -72,6 +69,7 @@ Vue.component('search',{
|
|||||||
get_insert_tag(jd[e]);
|
get_insert_tag(jd[e]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
console.log("err: " + e + f + g);
|
console.log("err: " + e + f + g);
|
||||||
});
|
});
|
||||||
@ -96,7 +94,7 @@ function get_insert_tag(id) {
|
|||||||
url: "api/tag/id/" + id,
|
url: "api/tag/id/" + id,
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).done(function(tag) {
|
}).done(function(tag) {
|
||||||
dat.push("#" + tag.name);
|
data.push("#" + tag.name);
|
||||||
}).fail(function(e, f, g) {
|
}).fail(function(e, f, g) {
|
||||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
console.log("cannot load " + id + ".json: " + e + f + g);
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user