{"id":13567869,"url":"https://github.com/u3u/vue-hooks","last_synced_at":"2025-04-12T22:20:25.813Z","repository":{"id":35007732,"uuid":"195412843","full_name":"u3u/vue-hooks","owner":"u3u","description":"⚡️Awesome Vue Hooks","archived":false,"fork":false,"pushed_at":"2023-01-04T03:56:44.000Z","size":2651,"stargazers_count":496,"open_issues_count":72,"forks_count":32,"subscribers_count":7,"default_branch":"dev","last_synced_at":"2025-04-06T16:00:14.671Z","etag":null,"topics":["vue","vue-composition-api","vue-function-api","vue-hooks","vue-use"],"latest_commit_sha":null,"homepage":"https://vue-hooks.netlify.com","language":"TypeScript","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/u3u.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-07-05T13:20:39.000Z","updated_at":"2025-03-13T00:23:03.000Z","dependencies_parsed_at":"2023-01-15T12:00:33.774Z","dependency_job_id":null,"html_url":"https://github.com/u3u/vue-hooks","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/u3u%2Fvue-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/u3u%2Fvue-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/u3u%2Fvue-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/u3u%2Fvue-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/u3u","download_url":"https://codeload.github.com/u3u/vue-hooks/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248638406,"owners_count":21137661,"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":["vue","vue-composition-api","vue-function-api","vue-hooks","vue-use"],"created_at":"2024-08-01T13:02:47.192Z","updated_at":"2025-04-12T22:20:25.782Z","avatar_url":"https://github.com/u3u.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Packages"],"sub_categories":[],"readme":"# vue-hooks [![NPM Version](https://img.shields.io/npm/v/@u3u/vue-hooks.svg)](https://www.npmjs.com/package/@u3u/vue-hooks) [![Build Status](https://img.shields.io/travis/u3u/vue-hooks/master.svg)](https://travis-ci.org/u3u/vue-hooks) [![Code Coverage](https://img.shields.io/codecov/c/github/u3u/vue-hooks.svg)](https://codecov.io/gh/u3u/vue-hooks)\n\n\u003e ⚡️ Awesome Vue Hooks\n\nUsing [`@vue/composition-api`](https://github.com/vuejs/composition-api) to implement useful vue hooks.  \nVue 3.0 has not been released yet, it allows you to use functional-based components in advance.\n\n⚠️ 2.x has been switched to `@vue/composition-api`, if you are using version 1.x please use [`vue-function-api`](https://npmjs.com/vue-function-api)\n\n## Install\n\n```sh\nyarn add @vue/composition-api @u3u/vue-hooks\n```\n\n## Documentation [![Netlify Status](https://api.netlify.com/api/v1/badges/e93d1698-f766-4529-b8e0-91fa1162d4cb/deploy-status)](https://app.netlify.com/sites/vue-hooks/deploys)\n\nDocs are available at \u003chttps://vue-hooks.netlify.com\u003e\n\n## Usage\n\n[![Edit Vue Hooks Examples](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/vue-template-66f2o?expanddevtools=1\u0026fontsize=12\u0026module=%2Fsrc%2FApp.vue)\n\n```js\nimport Vue from 'vue';\nimport VueCompositionAPI from '@vue/composition-api';\nimport hooks from '@u3u/vue-hooks';\n\nVue.use(hooks);\nVue.use(VueCompositionAPI); // Don't forget to use the plugin!\n```\n\n```jsx\nimport { createComponent } from '@vue/composition-api';\nimport { useWindowSize } from '@u3u/vue-hooks';\n\nexport default createComponent({\n  setup() {\n    const { width, height, widthPixel, heightPixel } = useWindowSize();\n    return { width, height, widthPixel, heightPixel };\n  },\n\n  render() {\n    const { width, height, widthPixel, heightPixel } = this;\n    return (\n      \u003cdiv id=\"app\" style={{ width: widthPixel, height: heightPixel }}\u003e\n        dynamic window size: {width}, {height}\n      \u003c/div\u003e\n    );\n  },\n});\n```\n\n## Hooks\n\n- [`useDate`](https://vue-hooks.netlify.com/?path=/story/usedate--docs) \u0026mdash; Using [`dayjs`](https://github.com/iamkun/dayjs) to process date.\n- [`useWindowSize`](https://vue-hooks.netlify.com/?path=/story/usewindowsize--docs) \u0026mdash; Tracks `window` dimensions.\n- [`useCounter`](https://vue-hooks.netlify.com/?path=/story/usecounter--docs) \u0026mdash; Tracks state of a number.\n- [`usePrevious`](https://vue-hooks.netlify.com/?path=/story/useprevious--docs) \u0026mdash; Returns the previous state or props.\n- [`useRouter`](https://vue-hooks.netlify.com/?path=/story/userouter--docs) \u0026mdash; A hook for [`vue-router`](https://github.com/vuejs/vue-router).\n- [`useStore`](https://vue-hooks.netlify.com/?path=/story/usestore--docs) \u0026mdash; A hook for [`vuex`](https://github.com/vuejs/vuex).\n- [`useState`](https://vue-hooks.netlify.com/?path=/story/usestate--docs) \u0026mdash; A hook for [`mapState`](https://vuex.vuejs.org/api/#mapstate).\n- [`useGetters`](https://vue-hooks.netlify.com/?path=/story/usegetters--docs) \u0026mdash; A hook for [`mapGetters`](https://vuex.vuejs.org/api/#mapgetters).\n- [`useMutations`](https://vue-hooks.netlify.com/?path=/story/usemutations--docs) \u0026mdash; A hook for [`mapMutations`](https://vuex.vuejs.org/api/#mapmutations).\n- [`useActions`](https://vue-hooks.netlify.com/?path=/story/useactions--docs) \u0026mdash; A hook for [`mapActions`](https://vuex.vuejs.org/api/#mapactions).\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b feat/new-hook`\n3. Commit your changes: `git commit -am 'feat(hooks): add a new hook'`\n4. Push to the branch: `git push origin feat/new-hook`\n5. Submit a pull request :D\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://qwq.cat\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/20062482?v=4\" width=\"100px;\" alt=\"u3u\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eu3u\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/u3u/vue-hooks/commits?author=u3u\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/u3u/vue-hooks/commits?author=u3u\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#example-u3u\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"https://github.com/u3u/vue-hooks/commits?author=u3u\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fu3u%2Fvue-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fu3u%2Fvue-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fu3u%2Fvue-hooks/lists"}