Add index values to js and vue tree view

clipboard.png

{
        "name": "",
        index:1,
        "children":[
            {
                "name":"",
                index:2,
            },{
                "name":"",
                index:2,
                "children":[
                    {
                        "name":"",
                        index:3,
                    },{
                        "name":"",
                        index:3,
                    },
                ]
            }
        ]
    }
    

want to add their index, for each layer in this tree

Apr.03,2021


    function fun(arry){
        for(let i in arry){
            let menu = arry[i];
            if(!menu['num']){
                menu['num'] = 1;
            }
            if(menu['children'].length && menu['children']){
                for(let j in menu['children']){
                    menu['children'][j]['num'] = arry[i]['num'] + 1;
                    fun(menu['children'])
                }
            }
        }
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb495b-24ea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb495b-24ea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?