import { Router, RouteRecordRaw } from 'vue-router'; export const getElementKey = (el: HTMLElement): string => { if (!el) return ''; const attrValue = el.getAttribute('ml-key'); if (attrValue && attrValue.length > 0) { return attrValue; } const dataValue = el.dataset.mlKey; if (dataValue && dataValue.length > 0) { return dataValue; } return ''; }; export const isAllRouteHaveName = (router: Router) => { const { options } = router; let res = true; const helper = (routeConfig: RouteRecordRaw) => { if (!res) { return; } if (!routeConfig.name) { res = false; return; } if (routeConfig.children) { routeConfig.children.forEach((route) => { helper(route); }); } }; if (options.routes) { options.routes.forEach((route) => { helper(route); }); } return res; };