mohen-vueuse
v1.0.2-1
Published
个人封装的vue3公共方法
Downloads
4
Readme
Get started
mohen-vueuse is a collection of utility functions based on Composition API. We assume you are already familiar with the basic ideas of Composition API before you continue.
Installation
npm i mohen-vueuse
Usage Example
import { useMouse, usePreferredDark, useLocalStorage } from 'mohen-vueuse'
export default {
setup() {
// tracks mouse position
const { x, y } = useMouse()
// is user prefers dark theme
const isDark = usePreferredDark()
// persist state in localStorage
const store = useLocalStorage(
'my-storage',
{
name: 'Apple',
color: 'red',
},
)
return { x, y, isDark, store }
}
}