0.1.0 • Published 1 year ago
matias-vue-storage v0.1.0
matias-vue-storage
vue 的 ref 和 reactive 添加了本地持久化的能力。
使用
安装
pnpm
$ pnpm add -D matias-vue-storageyarn
$ yarn add -D matias-vue-storagenpm
$ npm install -D matias-vue-storage使用
import { localRef, localReactive } from 'matias-vue-storage'
const router = useRouter()
interface TestType {
random: number
}
const localKey = 'KEY'
let localObjectValue = localReactive<TestType>(localKey + '_OBJECT')
const changeObjectValue = () => {
localObjectValue.random = Math.random() * 100
}
let localStringValue = localRef(localKey + '_STRING', Math.random() * 100 + '')
const changeStringValue = () => {
localStringValue.value = `${Math.random() * 100}`
}版本
0.1.0
localRef支持string、boolean、numberlocalReactive支持object
0.1.0
1 year ago