$ npm install @vueuse/core
Collection of essential Vue Composition API (inspired by react-use)
npm i @vueuse/core@next
npm i @vue/composition-api
npm i @vueuse/core
Please register the Composition API Plugin before other using APIs.
<!-- For Vue 3.x -->
<script src="https://unpkg.com/@vueuse/core@next"></script>
<!-- For Vue 2.x -->
<script src="https://unpkg.com/@vueuse/core"></script>
It will be exposed to global variable window.VueUse
You can checkout the documents and live demos in Storybook.
Animation
Browser
Misc
Sensors
State
More functions to be added. Please keep turned. (PRs are also welcome!)
For every release, it will release two version of this package. The 3.x.x is used for Vue 3.x and the 2.x.x is used for 2.x. We use the major version number to distinguish the different target version will the minor and patch numbers are shared in both packages.
Since the Composition API will be available in 3.x. Using it in 2.x require you use a polyfill. For 3.x build, we use the API from @vue/runtime-dom, and for 2.x, it's @vue/composition-api
// 3.x build
import { ref } from '@vue/runtime-dom'
// 2.x build
import { ref } from '@vue/composition-api'
This project is heavily inspired by following awesome projects.
Thanks!
MIT License © 2019-2020 Anthony Fu
© 2010 - cnpmjs.org x YWFE | Home | YWFE