It might help to feed an object to a function that expects an object
This commit is contained in:
parent
374238d472
commit
4192845cef
6
main.js
6
main.js
|
@ -5,7 +5,7 @@
|
||||||
function initLists (lists){
|
function initLists (lists){
|
||||||
const menuContainer = document.getElementById('menu-container');
|
const menuContainer = document.getElementById('menu-container');
|
||||||
|
|
||||||
menus.forEach( menu =>{
|
lists.forEach( menu =>{
|
||||||
const dropdownMenu = document.createElement('menu');
|
const dropdownMenu = document.createElement('menu');
|
||||||
const menuTitle = Object.assign(document.createElement('h2'), {innerHTML:menu.name});
|
const menuTitle = Object.assign(document.createElement('h2'), {innerHTML:menu.name});
|
||||||
const description = Object.assign(document.createElement('p'), {innerHTML:menu.description});
|
const description = Object.assign(document.createElement('p'), {innerHTML:menu.description});
|
||||||
|
@ -33,9 +33,7 @@ document.getElementById('import').onclick = function() {
|
||||||
const fr = new FileReader();
|
const fr = new FileReader();
|
||||||
|
|
||||||
fr.onload = function(e) {
|
fr.onload = function(e) {
|
||||||
console.log(e);
|
initLists(JSON.parse(e.target.result));
|
||||||
const result = JSON.parse(e.target.result);
|
|
||||||
initLists(JSON.stringify(result, null, 2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fr.readAsText(files.item(0));
|
fr.readAsText(files.item(0));
|
||||||
|
|
Loading…
Reference in a new issue