1.0.11 • Published 3 years ago

vue-refstorage v1.0.11

Weekly downloads
18
License
ISC
Repository
github
Last release
3 years ago

vue-refstorage

创建响应式对象 与 浏览器Storage关联 修改响应式对象 时 浏览器Storage中与其对应的键值也会被修改

使用前请确认node_modules中已经安装vue3 基于vue3的ref api

演示地址:https://aaaaa1414514.github.io/vue-refstorage

demo

import {refLocal,refSession} from 'vue-refstorage'

steup(props){
  const token = refLocal('toekn')    // ''
  
  // 当localStorage中没有toekn键名 时 将在localStorage中创建 toekn2:123
  const token2 = refLocal('token2','123)  // 123
  
  const token3 = refLocal('token3,[])   // []

  const token4= refLocal('token4,{})  // {}
  
  token.value = '请点击f12查看Local Storage'
}

refLocal (Function)

  参数 key value
  key: localStorage的键名  默认返回 ''
  value: 当localStorage没有当前key时返回 value 不传返回默认值 ''

refSession (Function)

  参数 key value
  key: sessionStorage的键名  默认返回 ''
  value: 当sessionStorage没有当前key时返回 value 不传返回默认值 ''
1.0.9

3 years ago

1.0.8

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago