()
| 12 | |
| 13 | // 获取缓存的思维导图数据 |
| 14 | export const getData = () => { |
| 15 | // 接管模式 |
| 16 | if (window.takeOverApp) { |
| 17 | mindMapData = window.takeOverAppMethods.getMindMapData() |
| 18 | return mindMapData |
| 19 | } |
| 20 | // 操作本地文件模式 |
| 21 | if (vuexStore.state.isHandleLocalFile) { |
| 22 | return Vue.prototype.getCurrentData() |
| 23 | } |
| 24 | let store = localStorage.getItem(SIMPLE_MIND_MAP_DATA) |
| 25 | if (store === null) { |
| 26 | return simpleDeepClone(exampleData) |
| 27 | } else { |
| 28 | try { |
| 29 | return JSON.parse(store) |
| 30 | } catch (error) { |
| 31 | return simpleDeepClone(exampleData) |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | // 存储思维导图数据 |
| 37 | export const storeData = data => { |
no test coverage detected