@burh/nuxt-core 1.0.371 → 1.0.373
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -104,22 +104,23 @@
|
|
|
104
104
|
v-model="city"
|
|
105
105
|
placeholder="Cidade"
|
|
106
106
|
filterable
|
|
107
|
-
|
|
107
|
+
remote
|
|
108
|
+
:remote-method="getCityListFiltered"
|
|
109
|
+
:auto-complete="`new-${city}`"
|
|
108
110
|
:error="errors[0]"
|
|
109
111
|
:valid="errors.length ? true : false"
|
|
112
|
+
:loading="isSelectLoading"
|
|
110
113
|
>
|
|
111
114
|
<div class="text-center" slot="empty">
|
|
112
115
|
<p class="small mb-2 mt-3">Nenhuma cidade encontrada</p>
|
|
113
116
|
</div>
|
|
114
117
|
|
|
115
118
|
<el-option
|
|
116
|
-
v-for="city in
|
|
119
|
+
v-for="city in cityListFiltered"
|
|
117
120
|
:key="city.value"
|
|
118
121
|
:value="city.value"
|
|
119
122
|
:label="city.value"
|
|
120
|
-
|
|
121
|
-
{{ city.value }}
|
|
122
|
-
</el-option>
|
|
123
|
+
/>
|
|
123
124
|
</el-select>
|
|
124
125
|
</div>
|
|
125
126
|
</validation-provider>
|
|
@@ -200,6 +201,7 @@ export default {
|
|
|
200
201
|
isActive(to) {
|
|
201
202
|
if (!to) {
|
|
202
203
|
this.resetFields();
|
|
204
|
+
this.cityList = [];
|
|
203
205
|
}
|
|
204
206
|
},
|
|
205
207
|
userData(to) {
|
|
@@ -227,10 +229,10 @@ export default {
|
|
|
227
229
|
cep: '',
|
|
228
230
|
address: '',
|
|
229
231
|
city: '',
|
|
230
|
-
|
|
231
232
|
isEditing: false,
|
|
232
|
-
|
|
233
|
+
isSelectLoading: false,
|
|
233
234
|
cityList: [],
|
|
235
|
+
cityListFiltered: [],
|
|
234
236
|
permissions: false,
|
|
235
237
|
permessionsData: [
|
|
236
238
|
{
|
|
@@ -278,15 +280,21 @@ export default {
|
|
|
278
280
|
});
|
|
279
281
|
},
|
|
280
282
|
async getCityList() {
|
|
281
|
-
|
|
283
|
+
this.cityList = await fetch('https://raw.githubusercontent.com/Skuth/cidades-com-estados-brasil/main/cidades.json')
|
|
282
284
|
.then(res => res.json())
|
|
283
285
|
.catch(() => {});
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
},
|
|
287
|
+
getCityListFiltered(query) {
|
|
288
|
+
if (query && query.length > 3) {
|
|
289
|
+
this.cityListFiltered = this.cityList.filter(city => String(city.city).toLowerCase().startsWith(query.toLowerCase()));
|
|
290
|
+
this.cityListFiltered = this.cityListFiltered.map(city => {
|
|
291
|
+
return {
|
|
292
|
+
value: `${city.city} / ${city.uf}`
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
} else {
|
|
296
|
+
this.cityListFiltered = [];
|
|
297
|
+
}
|
|
290
298
|
},
|
|
291
299
|
async checkZipcode() {
|
|
292
300
|
await this.$services.company
|