{"id":23467269,"url":"https://github.com/pmj136/xp-picker","last_synced_at":"2025-06-12T05:06:53.843Z","repository":{"id":245319087,"uuid":"325593416","full_name":"Pmj136/xp-picker","owner":"Pmj136","description":"A time-selector component ,based on  Uniapp","archived":false,"fork":false,"pushed_at":"2022-04-01T12:41:20.000Z","size":104,"stargazers_count":101,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T19:40:00.171Z","etag":null,"topics":["picker","time-picker","uniapp"],"latest_commit_sha":null,"homepage":"","language":"Vue","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/Pmj136.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-30T16:09:49.000Z","updated_at":"2025-01-16T01:31:09.000Z","dependencies_parsed_at":"2024-06-21T11:41:15.110Z","dependency_job_id":null,"html_url":"https://github.com/Pmj136/xp-picker","commit_stats":null,"previous_names":["pmj136/xp-picker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Pmj136/xp-picker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pmj136%2Fxp-picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pmj136%2Fxp-picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pmj136%2Fxp-picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pmj136%2Fxp-picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pmj136","download_url":"https://codeload.github.com/Pmj136/xp-picker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pmj136%2Fxp-picker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259401993,"owners_count":22851864,"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":["picker","time-picker","uniapp"],"created_at":"2024-12-24T12:28:26.731Z","updated_at":"2025-06-12T05:06:53.821Z","avatar_url":"https://github.com/Pmj136.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xp-picker\n\n### \n- 上一代e-picker-plus的优化版本，适配任何可选列的配置，包括但不限于'y-m-d h:i'、'm-d'等，详情请看文档\n- 功能强、通用性强、多端兼容。兼容h5、微信小程序、QQ小程序(其他平台小程序未作测试)与app\n\n### 一、使用示例\n#### 示例1：函数式打开picker，通过 this.$refs[ref].show()\n```html\n    \u003ctemplate\u003e\n    \t\u003cview\u003e\n    \t\t\u003cxp-picker ref=\"picker\"  @confirm=\"confirm\" /\u003e\n    \t\t\u003cview @tap=\"show\"\u003e开启\u003c/view\u003e\n    \t\u003c/view\u003e\n    \u003c/template\u003e\n```\n```js\n\t\u003cscript\u003e\n\t\texport default {\n\t\t\tmethods: {\n\t\t\t\tshow() {\n\t\t\t\t\tthis.$refs.picker.show()\n\t\t\t\t},\n\t\t\t\tconfirm(e) {\n\t\t\t\t\tconsole.log(e)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\u003c/script\u003e\n```\n#### 示例2：xp-picker包含一个默认插槽，点击内容直接打开picker弹窗\n```html\n    \u003ctemplate\u003e\n    \t\u003cview\u003e\n    \t\t\u003cxp-picker @confirm=\"confirm\"\u003e打开\u003c/xp-picker\u003e\n    \t\u003c/view\u003e\n    \u003c/template\u003e\n```\n```js\n\t\u003cscript\u003e\n\t\texport default {\n\t\t\tmethods: {\n\t\t\t\tconfirm(e) {\n\t\t\t\t\tconsole.log(e)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\u003c/script\u003e\n```\n\n\n### 二、属性介绍\n\n| 字段             | 类型      | 必填 | 默认值               | 描述  |\n| ----------- | -------- | ---- | ---------------------- | ------------------------------- |\n| mode             | String | 否  |  ymd                   | 见下方mode 详细介绍       |\n| height           | Number | 否  |  35                    | 选择器的高度，单位vh     |\n| animation        | Boolean| 否  |  true                     | 打开和关闭是否使用动画效果      |\n| value     | String | 否  |  当前时间                  | 打开选择器时默认选中的时间,详细见下方使用方式      |\n| year-range      |Array | 否  | [2016,null]      | 数组第一项代表开始年份(配置为null将使用默认2016)，第二项代表结束年份(配置null将使用本年)，配置示例:[2010,null]     |\n| history       | Boolean| 否  |  false                    | 每次打开picker时，是否保持用户最后一次选择的历史时间，若为fasle,则每次打开显示当前时间|\n| action-position| String|否   |top     |       可选 bottom,设置\"取消\"和\"确定\"按钮的位置      |\n| ~~startRule~~       | |   |                  | v2.0已移除      |\n| ~~endRule~~       | |  |                      | v2.0已移除      |\n| ~~start~~        |  |   |               | v1.2已移除    |\n| ~~end~~          |  |   |              | v1.2已移除     |\n| ~~errorMsg~~         |  |   |   | v1.2已移除     |\n\n\n### 1、mode的使用(y年；m月；d日；h时；i分；s秒)\n| 可选类型             | 描述  |\n| -------| --------------------------------- |\n| y        | picker将只显示 '年'一列       |\n| ym        | picker将只显示 '年月'两列      |\n| ymd        | picker将只显示 '年月日'两列      |\n| ymdh      | picker将只显示 '年月日时'四列       |\n| ymdhi     | picker将显示 '年月日时分'五列       |\n| ymdhis     | picker将显示 '年月日时分秒'六列      |\n| m       | 略……        |\n| d       | 略……         |\n| h       | 略……         |\n| i       | 略……         |\n| s       | 略……         |\n| md       |略……        |\n| hi       | 略……         |\n| is      | 略……         |\n| his       | 略……        |\n| mdh       | 略……         |\n| mdhi       | 略……         |\n| mdhis      | 略……       |\n\n未出现在表格中的配置代表不支持。但是xp-picker可以适配任何自定义列，比如：其中'dh'未预定义，因此只需在源码加一行dh的预定义即可(util.js/getLocalTime)，不会联系作者，热心答复\n### 2、value的使用\n此选项用于自定义picker打开时的显示时间，同样需要与mode对应  \n\n| mode    | value格式（必须）  |\n| --------- | --------------------------------- |\n| ymd   |  yyyy-MM-dd  |\n| his    | HH:mm:ss    |\n|    …… |      ……     |\n\n\n### 三、事件\n\n| 字段      | 描述  |\n| --------- | ------------------------ |\n| confirm   | 点击确定按钮的响应事件     | \n| cancel    | 关闭picker的响应事件     |\n\n#### confirm 事件返回属性介绍\n| 属性      | 类型  | 描述    |\n| --------- | ------------------------ |--------------------------|\n| ~~isOverTime~~   |     | v2.0.0已移除|\n| value    | String     |选择的时间 例如:'2020-12-06'|\n| ~~resultArr~~    |     |v2.1.0已移除|\n| timestamp    | BigInt     |返回的时间戳，支持理论可转换的时间|\n\n\n### 四、插槽\n可使用此方式打开picker弹窗\n\n### 五、讨论\n- 若你有需求是：只要显示 '月'和'日' 即 mode='md'，没有 '年' 这一列。而'日期'这一列考虑平闰年，也由年份决定，因此这类mode的默认年份是本年，\npicker智能的解决了平闰年的问题；以此类推，没有 年和月 ，picker将默认本年本月\n- 源码采用原生picker-view组件搭建的界面，因此界面可以根据自己的界面需求添砖加瓦  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmj136%2Fxp-picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmj136%2Fxp-picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmj136%2Fxp-picker/lists"}