SOURCE

const data = [
    'asd',
    {
        label: "导航名称 :",
        prop: "nav_name",
        type: "input",
        rules:[{ required: 'asd', message: "导航名称不能为空1"}],
        bind: {
            "placeholder": "请输入导航名称",
        },
    },
  	[
        [
            { required: 'ad', message: "导航名称不能为空"},
            { required: ['find me'], message: "导航名称不能为空2"}
        ],
    ],
    {
        label: "导航图标 :",
        prop: "icon",
        type: "image",
        content: "未选中的导航图标,png格式,建议尺寸为80px * 80px;<br>如果是中间凸起的按钮,建议为120px * 120px的png图片",
        rules:[{ required: true, message: "导航图标不能为空"}],
    },
    {
        label: "导航选中图标 :",
        prop: "active_icon",
        type: "image",
        content: "选中的导航图标,png格式,建议尺寸为80px * 80px;<br>如果是中间凸起的按钮,建议为120px * 120px的png图片",
        rules:[{ required: true, message: "导航选中图标不能为空"}],
    },
    {
        label: "排序 :",
        prop: "sort",
        type: "input",
        rules:[{ required: true, message: "不能为空"}],
        bind: {
            "placeholder": "请输入排序",
        },
        content: "菜单将以该排序规则从左到右排列,数值越小越靠前,不设置排序将以录入时间倒序排列",
    },
    {
        label: "跳转类型 :",
        prop: "jump_type",
        type: "radio",
        rules:[{ required: true, message: "导航名称不能为空"}],
        options: [
            {
                label: '本小程序',
                value: 1
            },
            {
                label: '其他小程序',
                value: 2
            },
        ],
    },
    {
        label: "跳转地址 :",
        prop: "jump_url",
        type: "input",
        bind: {
            "placeholder": "请输入跳转地址",
        },
        style: {
            display: 'block'
        },
        content: "点击导航后将要跳转的页面路由,该路由必须是小程序已注册过的,否则无效,例:/pages/index/index?id=1",
    },
    {
        label: "其他小程序appid :",
        prop: "appid",
        type: "input",
        bind: {
            "placeholder": "请输入其他小程序appid",
        },
        style: {
            display: 'none'
        },
        content: "点击导航后将要跳转的页面路由,该路由必须是小程序已注册过的,否则无效",
    },
    {
        label: "其他小程序页面地址 :",
        prop: "mp_page",
        type: "input",
        bind: {
            "placeholder": "请输入其他小程序页面地址",
        },
        style: {
            display: 'none'
        },
        content: "点击导航后将要跳转的页面路由,例:/pages/index/index?id=1",
    },
    {
        label: "是否显示 :",
        prop: "zz",
        type: "radio",
        rules:[{ required: true, message: "请选择菜单是否显示"}],
        options: [
            {
                label: '显示',
                value: 1
            },
            {
                label: '隐藏',
                value: 0
            },
        ],
    },
];

/**
 * 查找指定值的复杂多维数组,返回该值的索引路径
 * @param {object} arr 要查找的数组
 * @param {string} val 要查找的值(必须唯一)
 * @param {string} key 要查找的值对应的键 [可选]
 * @return {array} index 返回索引路径
 */
const search_obj_key = function (arr, val, position) {
    let idx_path = '';
    function _foreach (arr, val, position) {
        var temp = '';
        arr.forEach((item, index) => {
            temp = position ? position + ',' + index : index;
            _findValue(item, index, temp);
            if (Object.prototype.toString.call(item) == '[object Object]') { 
                let _array = Object.values(item);
                for(var arr_idx in _array){
                    _findValue(_array[arr_idx], index, temp);
                }
            }
            if (Object.prototype.toString.call(item) == '[object Array]') { 
                _foreach(item, val, temp);
            }
        })
    }
    function _findValue (item, index, temp) {
        if (item === val) {
            idx_path = temp;
            return;
        } else if (Object.prototype.toString.call(item) == '[object Array]') {
            _foreach(item, val, temp);
        } else if (Object.prototype.toString.call(item) == '[object Object]') { 
            let _array = Object.values(item);
            for(var arr_idx in Object.values(item)){
                _findValue(_array[arr_idx], index, temp);
            }
        }
    }
    _foreach(arr, val, position);
    if(!idx_path){
        return false;
    }
    return idx_path.toString().split(',').map((v)=>{return parseInt(v)});
}

let a = search_obj_key(data, '不能为空');
console.log(a)
console 命令行工具 X clear

                    
>
console