{"id":20968009,"url":"https://github.com/microzz/select-plugin","last_synced_at":"2025-07-26T01:13:09.713Z","repository":{"id":65493775,"uuid":"84333860","full_name":"microzz/select-plugin","owner":"microzz","description":"💎一个三级联动小插件","archived":false,"fork":false,"pushed_at":"2017-03-12T10:10:47.000Z","size":2917,"stargazers_count":50,"open_issues_count":1,"forks_count":16,"subscribers_count":5,"default_branch":"1.0.10","last_synced_at":"2025-05-03T14:22:57.926Z","etag":null,"topics":["es6","javascript","js","npm","plugin","select"],"latest_commit_sha":null,"homepage":"https://microzz.github.io/select-plugin/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microzz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-08T15:11:45.000Z","updated_at":"2025-03-22T09:33:53.000Z","dependencies_parsed_at":"2023-01-25T21:15:15.730Z","dependency_job_id":null,"html_url":"https://github.com/microzz/select-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microzz%2Fselect-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microzz%2Fselect-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microzz%2Fselect-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microzz%2Fselect-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microzz","download_url":"https://codeload.github.com/microzz/select-plugin/tar.gz/refs/heads/1.0.10","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254112548,"owners_count":22016791,"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":["es6","javascript","js","npm","plugin","select"],"created_at":"2024-11-19T03:03:29.919Z","updated_at":"2025-05-14T09:33:25.209Z","avatar_url":"https://github.com/microzz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# select-plugin\n## 介绍\n一个三级联动的生成器插件，默认生成中国地区🇨🇳的三级联动数据，也可以自定义数据。\n\n## 安装\n输入 `npm install select-plugin` .  \n\n最好先初始化一下package.json文件，输入 `npm init -y`，然后再执行安装`npm install select-plugin`\n\n## 使用\n### **默认数据**\n 引入js文件。  \n 在html文件中插入`\u003cscript src=\"./node_modules/select-plugin/dist/select-plugin-all.js\"\u003e\u003c/script\u003e`，  \n 然后  \n `\u003cscript\u003enew Select()\u003c/script\u003e`  \n 默认就可以生成中国地区的三级联动数据啦😄\n\n### **自定义数据**\n如果你**只使用**自定义的数据，建议只引入不包含地区数据的js文件，  \n即`\u003cscript src=\"./node_modules/select-plugin/dist/select-plugin.js\"\u003e\u003c/script\u003e`，  \n这样文件大小可以减少很多，毕竟大中国地区数据太庞大了😇但是务必传递传递相关参数！\u003cbr/\u003e  \n`new Select('.container', data, id, text);` \u003cbr/\u003e  \n**参数依次是插入父容器位置（默认是body，参数是CSS3选择器的形式，如'#id' , ' .className'），数据，在DOM元素的id，显示的文本**\n\n### 示例\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n  \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"\u003e\n  \u003ctitle\u003e三级联动生成器插件\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cdiv class=\"container\"\u003e\u003c/div\u003e\n\n  \u003cscript src=\"./node_modules/select-plugin/dist/select-plugin-all.js\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n  // 不传任何参数,默认生成中国地区三级联动\n    new Select();\n\n  // 自定义数据\n    var data = {\n                One: ['a1', 'a2', 'a3'],\n                Two: [\n                  ['a11', 'a12', 'a13'],\n                  ['a21', 'a22'],\n                  ['a31', 'a32']\n                ],\n                Three:  [\n                  [['a111', 'a112'], ['a121', 'a122'], ['a131', 'a132']],\n                  [['a211', 'a212'], ['a221', 'a222']],\n                  [['a311'], ['a312']]\n                ]\n              };\n    var id = ['one', 'two', 'three'];\n    var text = ['选项1', '选项2', '选项3'];\n    // 参数依次是插入父容器位置，数据，DOM的id，显示的文本\n    new Select('.container', data, id, text);\n  \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### 效果预览\n![select-plugin](https://github.com/microzz/select-plugin/blob/1.0.0/preview.png?raw=true)\n\n### 在线预览\n[在线预览地址1](https://microzz.github.io/select-plugin/)  \n[在线预览地址2](http://microzz.cn/select-plugin/)\n\n### About\nGitHub： https://github.com/microzz  \u003cbr/\u003e\n个人网站：[https://microzz.com/](https://microzz.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrozz%2Fselect-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrozz%2Fselect-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrozz%2Fselect-plugin/lists"}