Create item on enter.

This commit is contained in:
aminecmi 2022-07-17 20:52:35 +02:00
parent 9f7bacede8
commit 3405ac3cc1

View File

@ -103,11 +103,15 @@ export default {
recopyItemsObject: function () {
this.searchResults = this.initialItems.map(x => ({...x}));
},
searchItem: function () {
if (this.searchQ.length > 0) {
this.searchResults = this.searchResults.filter(i => i.content.toLowerCase().indexOf(this.searchQ.toLowerCase()) >= 0)
searchItem: function (e) {
if (e.key === 'Enter') {
this.createItem();
} else {
this.recopyItemsObject();
if (this.searchQ.length > 0) {
this.searchResults = this.searchResults.filter(i => i.content.toLowerCase().indexOf(this.searchQ.toLowerCase()) >= 0)
} else {
this.recopyItemsObject();
}
}
},
addItem: function (item) {