M
M
Max99992020-06-21 16:46:27
JSON
Max9999, 2020-06-21 16:46:27

Vue, city search in json?

Hello.
It is necessary to implement a search on vue, the same as here when posting the question "Question tags", only take the data from a large json (800kb) i.e. The person begins to enter the name of the city and already possible options are substituted from the file. What is the best way to implement this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Igor, 2020-06-21
@Max9999

Load JSON with Ajax and check the field for matching by trigger (for example, here by pressing Enter)

C
coderisimo, 2020-06-21
@coderisimo

For example - TYTS
Look there Asynchronous select The idea is not to load anything in advance, but simply contact the server, which will return a set that matches the search criteria.
This is standard practice. It makes no sense to load the entire JSON every time, even if it is not needed

D
Developer, 2020-06-21
@samodum

If you were not too lazy to look, you would see that here, as in general on all sites, there is a call to the server:
https://qna.habr.com/search/suggest?term=aja

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question