| | |
| | | */ |
| | | static openIndexDB (db) { |
| | | try { |
| | | let request = window.indexedDB.open(db, 2) |
| | | let request = window.indexedDB.open(db, 3) |
| | | request.onerror = () => { |
| | | console.warn('IndexedDB 初始化失败!') |
| | | } |
| | |
| | | if (!window.GLOB.IndexDB.objectStoreNames.contains('caches')) { |
| | | window.GLOB.IndexDB.createObjectStore('caches', { keyPath: 'menuid' }) |
| | | } |
| | | if (window.GLOB.systemType === '' && !window.GLOB.IndexDB.objectStoreNames.contains('funcs')) { |
| | | window.GLOB.IndexDB.createObjectStore('funcs', { keyPath: 'id' }) |
| | | } |
| | | // if (!window.GLOB.IndexDB.objectStoreNames.contains('funcs')) { |
| | | // window.GLOB.IndexDB.createObjectStore('funcs', { keyPath: 'id' }) |
| | | // } |
| | | } |
| | | } catch (e) { |
| | | console.warn('IndexedDB 初始化失败!') |
| | |
| | | request.onsuccess = (e) => { |
| | | let cursor = e.target.result |
| | | if (cursor) { |
| | | if (cursor.value.CreateDate < date) { |
| | | if (cursor.value.CreateDate < date || cursor.value.CreateDate.length === 10) { |
| | | cursor.delete() |
| | | } |
| | | cursor.continue() |