javascript - City selector in those websites
给我你的怀抱
给我你的怀抱 2017-05-19 10:34:02
0
4
711

Many websites have city selectors. How are these components maintained?
Is there any city database available?
Now I need to use the city selector in my website. I use element UI. This UI does not seem to be integrated.
I would like to ask where to get the city data? Or is there a city selector component that can be used directly?

给我你的怀抱
给我你的怀抱

reply all(4)
某草草

City data can be imported into your own database through the API of Amap. For example: here

为情所困

This data can be imported from a third party, but due to strong dependencies, it may not be too stable. For example, the front end requests a third-party interface or the back end calls a third-party interface and returns it to the front end.

You can also go to the National Bureau of Statistics website to get the latest data source, or export it from a third-party service, and then do some processing yourself to get it into the corresponding format. Then either the backend stores its own database and the frontend requests its own interface to obtain it (this is a common practice), or the frontend creates a js object and puts it in a file to load as a website static resource, and then reads the global object (this is not very reliable). Spectrum, but small backend management system projects can also be done this way, because they will not be made public).

刘奇

Generally, it depends on the specific needs. Sometimes it is necessary to select only specified cities. You need to maintain a set of linkage data in the background. If you need nationwide resources, just go online and find resources

曾经蜡笔没有小新

I found a copy in the ecshop code. Of course it is not the latest, but it is not much different.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template