{"id":17101227,"url":"https://github.com/doabit/city_picker","last_synced_at":"2025-03-23T19:15:59.693Z","repository":{"id":138007064,"uuid":"139516346","full_name":"doabit/city_picker","owner":"doabit","description":"中国省市区街道四级联动地址选择器。","archived":false,"fork":false,"pushed_at":"2018-07-03T02:11:23.000Z","size":441,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T01:56:15.257Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doabit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-03T02:10:09.000Z","updated_at":"2019-07-31T08:46:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"1b5c2d53-b7a7-4020-bc4a-4f6b449516b0","html_url":"https://github.com/doabit/city_picker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doabit%2Fcity_picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doabit%2Fcity_picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doabit%2Fcity_picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doabit%2Fcity_picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doabit","download_url":"https://codeload.github.com/doabit/city_picker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245153896,"owners_count":20569408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T15:24:23.684Z","updated_at":"2025-03-23T19:15:59.664Z","avatar_url":"https://github.com/doabit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CityPicker\n中国省市区街道四级联地址选择，js代码来自 [city-picker](https://github.com/huangchanghuan/city-picker), 数据来自 [Administrative-divisions-of-China](https://github.com/modood/Administrative-divisions-of-China)\n\n## 安装\n\n### Gemfile\n\n```ruby\ngem 'city_picker'\n```\n\n### app/assets/javascripts/application.js\n\n```javascript\n//= require city_picker/city_picker\n```\n\n### app/assets/stylesheets/application.css\n\n```javascript\n*= require city_picker/city_picker\n```\n\nconfig/routes.rb\n```ruby\nmount CityPicker::Engine =\u003e \"/city_picker\"\n```\n\n## 使用\n\n在页面中加入\n\n```html\n\u003cdiv style=\"position: relative;\"\u003e\n  \u003c!-- container --\u003e\n  \u003cinput readonly type=\"text\"  placeholder=\"请选择省/市\"  id=\"target\" style=\"width:100%\"\u003e\n\u003c/div\u003e\n```\n\n```javascript\n\u003cscript\u003e\n  $(function() {\n    $('#target').citypicker({\n      responsive: true,\n      simple: true,\n      // level: 'district'\n      // addrElm: '#addrValue1'\n    });\n\n    $('#target').on('cp:updated', function(e) {\n      console.log($(this).val())\n    })\n  })\n\u003c/script\u003e\n```\n\n 如果要在选择后取得城市code，可在页面添加\n\n ```html\n \u003cinput type=\"text\" id=\"addrValue\"\u003e\n ```\n\n 或者 添加初始化选项 `addrElm: '#my_address_elm`\n\n ```html\n  \u003cinput type=\"text\" id=\"my_address_elm\"\u003e\n ```\n\n\n## Contributing\nContribution directions go here.\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoabit%2Fcity_picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoabit%2Fcity_picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoabit%2Fcity_picker/lists"}