wangting
2023-07-21 6d4ba6de5ad9b1a8f3b7b680aa3a3a2ce08b22a6
Source/UBCS-WEB/src/router/avue-router.js
@@ -99,6 +99,8 @@
      const propsDefault = {
        label: propsConfig.label || 'name',
        path: propsConfig.path || 'path',
        fullPath: propsConfig.fullPath || 'fullPath',
        query:propsConfig.query || 'query',
        icon: propsConfig.icon || 'icon',
        children: propsConfig.children || 'children',
        meta: propsConfig.meta || 'meta',
@@ -117,9 +119,24 @@
            } else {
              return oMenu[propsDefault.path]
            }
          })(),
          })();
          let fullPath=path;
        let query=oMenu[propsDefault.query] || {};
        if(path.indexOf('?')!=-1){
          let params=path.split('?')[1].split('@');
          path=path.split('?')[0]
          params.forEach(pitem=>{
            try {
              query[pitem.split('=')[0]]=pitem.split('=')[1];
            }catch (e) {
              query[pitem.split('=')[0]]=null;
            }
          })
        }
          //特殊处理组件 执行完这个 component 也就是精确到具体的文件了  views文件夹下面就是具体的页面代码
          component = 'views' + oMenu.path,
         let component = 'views' + path,
          name = oMenu[propsDefault.label],
          icon = oMenu[propsDefault.icon],
          children = oMenu[propsDefault.children],
@@ -136,6 +153,9 @@
        const isChild = children.length !== 0;
        const oRouter = {
          path: path,
          fullPath:fullPath,
          query:query,
          params:query,
          component(resolve) {
            // 判断是否为首路由
            if (first) {
@@ -188,6 +208,7 @@
      // for循环结束
      // 这个first 卡的其实就是首路由
      if (first) {
        debugger;
        this.safe.$router.addRoutes(aRouter)
      } else {
        // 这里返回的是子组件