z-paging-config.js 452 B

1234567891011121314151617181920212223242526
  1. // [z-paging]处理main.js中的配置信息工具
  2. let config = null;
  3. let getedStorage = false;
  4. const storageKey = 'Z-PAGING-CONFIG-STORAGE-KEY'
  5. function setConfig(value) {
  6. try {
  7. uni.setStorageSync(storageKey, value);
  8. } catch (e) {}
  9. }
  10. function getConfig() {
  11. try {
  12. if (getedStorage) return config;
  13. config = uni.getStorageSync(storageKey);
  14. getedStorage = true;
  15. } catch (e) {
  16. return null;
  17. }
  18. }
  19. export default {
  20. setConfig,
  21. getConfig
  22. };