Ngiler SH3LL 360
Home
Information
Create File
Create Folder
:
/
home
/
tbf
/
duplicat_sala_palatului
/
resources
/
js
/
components
/
Information Server
MySQL :
OFF
Perl :
OFF
CURL :
ON
WGET :
OFF
PKEXEC :
OFF
Directive
Local Value
IP Address
89.40.16.97
System
Linux server.atelieruldeit.ro 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User
tbf
PHP Version
7.3.33
Software
Apache
Doc root
Writable
close
Edit File :
GeolocationComponent.vue
| Size :
2.93
KB
Copy
<template> <div> <multiselect v-model="selectedCountries" id="ajax" label="name" track-by="code" placeholder="Type to search" open-direction="bottom" :options="countries" :multiple="false" :searchable="true" :loading="isLoading" :internal-search="false" :clear-on-select="false" :close-on-select="true" :options-limit="300" :limit="3" :max-height="600" :show-no-results="false" :hide-selected="true" @search-change="asyncFind" @select="selectValue"> <template slot="option" slot-scope="{ option, remove }"><span class="custom__tag"><span>{{ option.name }}<span class="extra-mark">{{option.extra}}</span></span></span></template> <template slot="clear" slot-scope="props"> <div class="multiselect__clear" v-if="selectedCountries.length" @mousedown.prevent.stop="clearAll(props.search)"></div> </template><span slot="noResult">Oops! No elements found. Consider changing the search query.</span> </multiselect> </div> </template> <script> export default { data() { return { selectedCountries: [], countries: [], isLoading: false, timeout: null } }, components: { }, props: { field: Object, updateGeolocation: Function }, methods:{ selectValue(selectedOption, id){ this.updateGeolocation(selectedOption, this.field.name) }, asyncFind (query) { this.isLoading = true if(query.length > 3){ clearTimeout(this.timeout); this.timeout = setTimeout( () => { axios.get('/getGeolocations?search='+query).then(response => { this.selectedCountries = []; this.countries = response.data.geoname.map((data) => { if(data.countryCode == 'GB'){ return {name: `${data.name}`, extra: `, ${data.adminName2}, ${data.adminName1}`, value: `${data.name}, ${data.adminName2}, ${data.adminName1}`} }else{ if(typeof data.adminName1 != 'object'){ return {name: `${data.name}`, extra:`, ${data.adminName1}, ${data.countryName}`, value: `${data.name}, ${data.adminName1}, ${data.countryName}`} }else{ return {name: `${data.name}`, extra:`, ${data.countryName}`, value: `${data.name}, ${data.countryName}`} } } }) }) }, 500) } this.isLoading = false }, clearAll () { this.selectedCountries = [] } } } </script>
Back