mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-04-24 23:47:17 +08:00
Fix: Ensure route.children existence before accessing in initRouter()
This commit is contained in:
parent
5049e2fbe0
commit
59c9c3e267
@ -30,6 +30,7 @@ const getConfig = (key?: string): ServerConfigs => {
|
|||||||
export const getServerConfig = async (app: App): Promise<undefined> => {
|
export const getServerConfig = async (app: App): Promise<undefined> => {
|
||||||
app.config.globalProperties.$config = getConfig();
|
app.config.globalProperties.$config = getConfig();
|
||||||
return axios({
|
return axios({
|
||||||
|
method: "get",
|
||||||
url: `${configConver()}serverConfig.json`
|
url: `${configConver()}serverConfig.json`
|
||||||
})
|
})
|
||||||
.then(({ data: config }) => {
|
.then(({ data: config }) => {
|
||||||
|
@ -158,7 +158,12 @@ router.beforeEach((to: ToRouteType, _from, next) => {
|
|||||||
getTopMenu(true);
|
getTopMenu(true);
|
||||||
// query、params模式路由传参数的标签页不在此处处理
|
// query、params模式路由传参数的标签页不在此处处理
|
||||||
if (route && route.meta?.title) {
|
if (route && route.meta?.title) {
|
||||||
if (isAllEmpty(route.parentId) && route.meta?.backstage) {
|
if (
|
||||||
|
isAllEmpty(route.parentId) &&
|
||||||
|
route.meta?.backstage &&
|
||||||
|
route.children &&
|
||||||
|
route.children.length > 0
|
||||||
|
) {
|
||||||
// 此处为动态顶级路由(目录)
|
// 此处为动态顶级路由(目录)
|
||||||
const { path, name, meta } = route.children[0];
|
const { path, name, meta } = route.children[0];
|
||||||
useMultiTagsStoreHook().handleTags("push", {
|
useMultiTagsStoreHook().handleTags("push", {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user