You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
618 B
37 lines
618 B
1 year ago
|
// 获取本地存储对应key
|
||
|
const getStorage = (key)=>{
|
||
|
return uni.getStorageSync( key );
|
||
|
}
|
||
|
|
||
|
// 设置本地存储对应key
|
||
|
const setStorage = (key,value)=>{
|
||
|
return uni.setStorageSync( key,value );
|
||
|
}
|
||
|
|
||
|
// 清除全部本地存储
|
||
|
const clearStorage = ()=>{
|
||
|
uni.clearStorageSync();
|
||
|
}
|
||
|
|
||
|
// 清除指定key本地存储
|
||
|
const removeStorage = ( key )=>{
|
||
|
uni.removeStorageSync( key );
|
||
|
}
|
||
|
|
||
|
const constant = {
|
||
|
id:"id",
|
||
|
token:"token",
|
||
|
avatar: 'avatar',
|
||
|
name: 'name',
|
||
|
roles: 'roles',
|
||
|
permissions: 'permissions'
|
||
|
}
|
||
|
|
||
|
|
||
|
export default {
|
||
|
getStorage,
|
||
|
setStorage,
|
||
|
clearStorage,
|
||
|
removeStorage,
|
||
|
constant
|
||
|
}
|