{"id":30514184,"url":"https://github.com/ciaoca/cxselect","last_synced_at":"2025-08-26T07:16:06.092Z","repository":{"id":5684008,"uuid":"6894202","full_name":"ciaoca/cxSelect","owner":"ciaoca","description":"cxSelect 是基于 jQuery 的多级联动菜单插件，适用于省市、商品分类等联动菜单。","archived":false,"fork":false,"pushed_at":"2022-03-17T05:28:25.000Z","size":489,"stargazers_count":612,"open_issues_count":4,"forks_count":195,"subscribers_count":44,"default_branch":"master","last_synced_at":"2025-08-19T10:41:06.993Z","etag":null,"topics":["jquery","select","zepto"],"latest_commit_sha":null,"homepage":"http://ciaoca.github.io/cxSelect/","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/ciaoca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-28T01:30:23.000Z","updated_at":"2025-07-07T01:37:47.000Z","dependencies_parsed_at":"2022-08-30T16:11:26.717Z","dependency_job_id":null,"html_url":"https://github.com/ciaoca/cxSelect","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/ciaoca/cxSelect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciaoca%2FcxSelect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciaoca%2FcxSelect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciaoca%2FcxSelect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciaoca%2FcxSelect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ciaoca","download_url":"https://codeload.github.com/ciaoca/cxSelect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ciaoca%2FcxSelect/sbom","scorecard":{"id":282424,"data":{"date":"2025-08-11","repo":{"name":"github.com/ciaoca/cxSelect","commit":"ee708a201cb7b4264d2c6eeec93f543ead40846e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T16:15:27.788Z","repository_id":5684008,"created_at":"2025-08-17T16:15:27.788Z","updated_at":"2025-08-17T16:15:27.788Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272188365,"owners_count":24888787,"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","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["jquery","select","zepto"],"created_at":"2025-08-26T07:16:03.283Z","updated_at":"2025-08-26T07:16:06.085Z","avatar_url":"https://github.com/ciaoca.png","language":"JavaScript","readme":"# cxSelect\n\ncxSelect 是基于 jQuery 的多级联动菜单插件，适用于省市、商品分类等联动菜单。\n\n列表数据通过 AJAX 获取，也可以自定义，数据内容使用 JSON 格式。\n\n同时兼容 Zepto，方便在移动端使用。\n\n\n**版本：**\n* jQuery v1.7+ || Zepto v1.0+\n* jQuery cxSelect v1.4.2\n\nDemo: http://ciaoca.github.io/cxSelect/\n\n## 使用方法\n\n#### 载入 JavaScript 文件\n```html\n\u003cscript src=\"jquery.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"jquery.cxselect.js\"\u003e\u003c/script\u003e\n```\n\n#### DOM 结构\n\n```html\n\u003c!--\nselect 必须放在元素 id=\"element_id\" 的内部，不限层级\nselect 的 class 任意取值，也可以附加多个 class，如 class=\"province otherclass\"，在调用时只需要输入其中一个即可，但是不能重复\n--\u003e\n\u003cdiv id=\"element_id\"\u003e\n  \u003cselect class=\"province\"\u003e\u003c/select\u003e\n  \u003cselect class=\"city\"\u003e\u003c/select\u003e\n  \u003cselect class=\"area\"\u003e\u003c/select\u003e\n\u003c/div\u003e\n```\n\n#### 设置默认值\n\n```html\n\u003c!--\n方法一：使用 option 的 value 和 selected 属性\n--\u003e \n\u003cselect class=\"province\"\u003e \n  \u003coption value=\"浙江省\" selected\u003e浙江省\u003c/option\u003e \n\u003c/select\u003e \n \n\u003c!--\n方法二：使用 select 的 data-value 属性\n当同时设置 option 的 value 和 select 的 data-value 时，优先使用 data-value 的值\n--\u003e \n\u003cselect class=\"province\" data-value=\"浙江省\"\u003e\u003c/select\u003e \n```\n\n#### 调用 cxSelect\n\n``` javascript\n$('#element_id').cxSelect({\n  url: 'cityData.min.json',\n  selects: ['province', 'city', 'area'],  // selects 为数组形式，请注意顺序\n  emptyStyle: 'none'\n});\n```\n\n#### 设置参数全局默认值\n\n``` javascript\n$.cxSelect.defaults.url = 'cityData.min.json';\n$.cxSelect.defaults.emptyStyle = 'none';\n```\n\n\n## 参数说明\n\n名称|默认值|说明\n---|---|---\nselects|[]|下拉选框组。\u003cbr\u003e输入 select 的 className\nurl|null|整合数据接口地址（URL）\ndata|null|自定义数据，类型为数组，使用 JSON 格式。\nemptyStyle|null|子集无数据时 select 元素的显示状态。\u003cbr\u003e可设置为：**\"none\"**(display:none), **\"hidden\"**(visibility:hidden)\nrequired|false|是否为必选。\u003cbr\u003e设为 `false` 时，会在列表头部添加 `\u003coption value=\"{firstValue}\"\u003e{firstTitle}\u003c/option\u003e` 选项。\nfirstTitle|'请选择'|选框第一个项目的标题（仅在 `required` 为 `false` 时有效）\nfirstValue|''|选框第一个项目的值（仅在 `required` 为 `false` 时有效）\njsonSpace|''|数据命名空间\njsonName|'n'|数据标题字段名称（用于 option 的标题）\njsonValue|''|数据值字段名称（用于 option 的 value，没有值字段时使用标题作为 value）\njsonSub|'s'|子集数据字段名称\n\n\n\n## data 属性参数\n\n#### 父元素的 data- 属性\n```html\n\u003cdiv id=\"element_id\" data-url=\"cityData.min.json\" data-required=\"true\"\u003e\u003c/div\u003e\n```\n\n名称|说明\n---|---\ndata-selects|下拉选框组。\u003cbr\u003e输入 select 的 className，使用英文逗号分隔的字符串\ndata-url|列表数据接口地址\ndata-empty-style|子集无数据时 select 的显示状态\ndata-required|是否为必选\ndata-first-title|选框第一个项目的标题\ndata-first-value|选框第一个项目的值\ndata-json-space|数据命名空间\ndata-json-name|数据标题字段名称\ndata-json-value|数据值字段名称\ndata-json-sub|子集数据字段名称\n\n\n#### select 元素的 data- 属性\n\n```html\n\u003cselect class=\"province\" data-value=\"浙江省\" data-first-title=\"选择省\"\u003e\u003c/select\u003e\n```\n\n名称|说明\n---|---\ndata-value|默认选中值\ndata-url|当前选框的数据接口，详见 [DEMO](http://ciaoca.github.io/cxSelect/demo/oneself.html)\ndata-required|是否为必选\ndata-query-name|传递上一个选框值的参数名称（默认使用上一个选框的 name 属性值）\ndata-first-title|选框第一个项目的标题\ndata-first-value|选框第一个项目的值\ndata-json-space|数据命名空间\ndata-json-name|数据标题字段名称\ndata-json-value|数据值字段名称\n\n\n\n## API 接口\n\n``` javascript\nvar cxSelectApi;\n\n// 方法一：\ncxSelectApi = $.cxSelect($('#element_id'), {\n  selects: ['province', 'city', 'area']\n});\n\n// 方法二：\n$('#element_id').cxSelect({\n  selects: ['province', 'city', 'area']\n}, function(api) {\n  cxSelectApi = api;\n});\n\ncxSelectApi.attach();\ncxSelectApi.detach();\ncxSelectApi.clear();\ncxSelectApi.setOptions();\n```\n\n名称|说明\n---|---\nattach()|绑定。\u003cbr\u003e调用时会自动进行绑定，用于使用 detach 解除绑定后，进行重新绑定。\ndetach()|解除绑定。\u003cbr\u003e解除绑定后，不再具有联动效果。\nclear(index)|清空选项。\u003cbr\u003e清空第 index 个 select 自身及之后的 select 的选项。\u003cbr\u003e`index`: select 的序号，从 0 开始\nsetOptions(settings)|重新设置参数。\u003cbr\u003e`settings`: 与调用时参数一致\n\n\n\n## 自定义数据\n\n可以使用任何类型的数据作为值，但最终都会被转化为文本。\n\n\n\n## 各选项数据接口独立\n\n可以为每个`select`设置一个接口，根据接口返回的数据结构，设置`json-space`、`json-name`、`json-value`适应 JSON 结构。\n当页面加载时，第一个选框已有选项数据，可以不设置第一个选框的接口。\n\n[独立接口示例](http://ciaoca.github.io/cxSelect/demo/oneself.html)\n\n\n\n## 数据来源\n\n`cityData.json`\n\u003e 国内城市数据来源：[2019年中华人民共和国行政区划代码（截止2019年12月31日）](http://www.mca.gov.cn/article/sj/xzqh/1980/202002/20200200025008.shtml)\n\n`cityData-simple.json`\n\u003e 国内城市简称版本\n\u003e 不包含：\n\u003e - 一级 省、市、区\n\u003e - 二级 市、区、县、盟、州\n\n`globalData.json`\n\u003e 全球主要城市数据来源：整理国内常用网站和软件 Date: 2014.07.29\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciaoca%2Fcxselect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciaoca%2Fcxselect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciaoca%2Fcxselect/lists"}