https://github.com/markthree/reactivity-shared
通用的@vue/reactivity的use-api
https://github.com/markthree/reactivity-shared
reactivity shared use vue-use
Last synced: 6 months ago
JSON representation
通用的@vue/reactivity的use-api
- Host: GitHub
- URL: https://github.com/markthree/reactivity-shared
- Owner: markthree
- License: mit
- Created: 2022-01-22T14:34:52.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T08:55:20.000Z (almost 2 years ago)
- Last Synced: 2025-02-13T15:41:47.241Z (12 months ago)
- Topics: reactivity, shared, use, vue-use
- Language: TypeScript
- Homepage:
- Size: 59.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# reactivity-shared
通用的@vue/reactivity的use-api
## Motation 🐗
[vueuse](https://vueuse.org/) 是非常好用的 `use` 库,但却只能运行在 `web` 端,而这个库是 `vueuse` 中 不依赖环境的 `api` 👉 [@vueuse/shared](https://www.npmjs.com/package/@vueuse/shared) 的复刻与补充。可以运行在任何满足 `ES` 规范的环境,例如 `node`,`web` 等。当然也更激进,仅支持 `vue3`😋。
## Usage
### Install package
```sh
# npm
npm install reactivity-shared
# yarn
yarn install reactivity-shared
# pnpm
pnpm install reactivity-shared
```
### Import
```js
// ESM
import { ref, and, watch } from 'reactivity-shared'
const foo = ref(false)
const bar = ref(false)
watch(and(foo, bar), () => {
console.log("foo 和 bar 都为 true")
})
// CommonJS
const { ref, and, watch } = require('reactivity-shared')
const foo = ref(false)
const bar = ref(false)
watch(and(foo, bar), () => {
console.log("foo 和 bar 都为 true")
})
```
## License
Made with markthree
Published under [MIT License](./LICENSE).