UNPKG

press-ui

Version:

简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目

27 lines (26 loc) 520 B
export const storageUtil = { get(key) { let res; // #ifdef H5 res = localStorage.getItem(key); // #endif // #ifndef H5 if (typeof uni !== 'undefined') { res = uni.getStorageSync(key); } // #endif return res; }, set(key, value) { let res ; // #ifdef H5 res = localStorage.setItem(key, `${value}`); // #endif // #ifndef H5 if (typeof uni !== 'undefined') { res = uni.setStorageSync(key, `${value}`); } // #endif return res; }, };