layuiadmin单页版左侧菜单链接带参数无法选中的问题修改:
admin.js中的此方式matchMenu修改成:
,matchMenu = function(list){ var pathURL = admin.correctRouter(path.join('/')); var currHash = (location.hash).replace('#', '');//这里修改了 list.each(function(index1, item1){ var othis1 = $(item1) ,data1 = getData(othis1) ,listChildren1 = data1.list.children('dd') ,matched1 = path[0] == data1.name || (index1 === 0 && !path[0]) || (data1.jump && pathURL == admin.correctRouter(data1.jump)) || (data1.jump && currHash == admin.correctRouter(data1.jump)));//这里修改了 listChildren1.each(function(index2, item2){ var othis2 = $(item2) ,data2 = getData(othis2) ,listChildren2 = data2.list.children('dd') ,matched2 = (path[0] == data1.name && path[1] == data2.name) || (data2.jump && pathURL == admin.correctRouter(data2.jump)) || (data2.jump && currHash == admin.correctRouter(data2.jump)));//这里修改了 listChildren2.each(function(index3, item3){ var othis3 = $(item3) ,data3 = getData(othis3) ,matched3 = (path[0] == data1.name && path[1] == data2.name && path[2] == data3.name) || (data3.jump && pathURL == admin.correctRouter(data3.jump)) || (data3.jump && currHash == admin.correctRouter(data3.jump))//这里修改了 if(matched3){ var selected = data3.list[0] ? SIDE_NAV_ITEMD : THIS; othis3.addClass(selected).siblings().removeClass(selected); //标记选择器 return false; } }); if(matched2){ var selected = data2.list[0] ? SIDE_NAV_ITEMD : THIS; othis2.addClass(selected).siblings().removeClass(selected); //标记选择器 return false } }); if(matched1){ var selected = data1.list[0] ? SIDE_NAV_ITEMD : THIS; othis1.addClass(selected).siblings().removeClass(selected); //标记选择器 return false; } }); }