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;
|
|
}
|
|
|