minor
This commit is contained in:
@@ -12,6 +12,7 @@ v-row
|
|||||||
@input.native='search'
|
@input.native='search'
|
||||||
persistent-hint
|
persistent-hint
|
||||||
:items="places"
|
:items="places"
|
||||||
|
@focus='search'
|
||||||
@change='selectPlace')
|
@change='selectPlace')
|
||||||
template(v-slot:item="{ item, attrs, on }")
|
template(v-slot:item="{ item, attrs, on }")
|
||||||
v-list-item(v-bind='attrs' v-on='on')
|
v-list-item(v-bind='attrs' v-on='on')
|
||||||
@@ -73,7 +74,7 @@ export default {
|
|||||||
search: debounce(async function(ev) {
|
search: debounce(async function(ev) {
|
||||||
const search = ev.target.value.trim().toLowerCase()
|
const search = ev.target.value.trim().toLowerCase()
|
||||||
this.places = await this.$axios.$get(`place?search=${search}`)
|
this.places = await this.$axios.$get(`place?search=${search}`)
|
||||||
if (!search) { return this.places }
|
if (!search && this.places.length) { return this.places }
|
||||||
const matches = this.places.find(p => search === p.name.toLocaleLowerCase())
|
const matches = this.places.find(p => search === p.name.toLocaleLowerCase())
|
||||||
if (!matches) {
|
if (!matches) {
|
||||||
this.places.unshift({ create: true, name: ev.target.value.trim() })
|
this.places.unshift({ create: true, name: ev.target.value.trim() })
|
||||||
|
|||||||
Reference in New Issue
Block a user