People when I run Object Keys
it captures every Array of the Object and updates the data of component
only not all, and the output only comes with the last Array value:
var obj = {
index: {
path: "/",
component: "./platform/system/index/index.vue",
meta: {
nav: "none"
}
},
teste: {
path: "/teste",
component: "./platform/system/index/teste.vue",
children: {
userList: {
path: "/users",
component: "./platform/system/users/index.vue",
lazy: "base"
},
testList: {
path: "/system",
component: "./platform/system/test/system.vue",
lazy: "base"
}
}
}
};
class Access {
static getRaiz(obj) {
var teste = {};
Object.keys(obj).forEach(function(item) {
var json = obj[item],
directory = json.component;
Object.assign(teste, json, {
component: "() => import('" + directory + "')"
});
});
return JSON.stringify(teste, null, '\t');
}
}
document.body.innerHTML = '<pre>' + Access.getRaiz(obj) + '</pre>';