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.
		
		
		
		
		
			
		
			
				
					
					
						
							31 lines
						
					
					
						
							740 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							31 lines
						
					
					
						
							740 B
						
					
					
				| export function getLayerData() { | |
|   const layerData = require.context("./../images/layer", true, /^\.\/.*\.png$/); | |
|   const layerDatas = {}; | |
|   const resultData = []; | |
|   layerData.keys().forEach((item) => { | |
|     const [_, topic, title] = item.match(/[^/]+/g); | |
|     if (!layerDatas[topic]) { | |
|       resultData.push( | |
|         (layerDatas[topic] = { | |
|           title: topic, | |
|           status: "", | |
|           children: [], | |
|         }) | |
|       ); | |
|     } | |
| 
 | |
|     if (!title.endsWith("_fault.png")) { | |
|       layerDatas[topic].children.push({ | |
|         id: item, | |
|         title: title.replace(".png", ""), | |
|         status: "", | |
|       }); | |
|     } | |
|   }); | |
|   // data["事件专题"] =[ | |
|   //     "./事件专题/001.png" | |
|   // ] | |
|   console.log(resultData); | |
| 
 | |
|   return resultData; | |
| }
 | |
| 
 |