code: function getHooks(obj, key, opts) {
      let pres = null, posts = null;
      if (key) {
          if (obj) {
              const routeHooks = obj.routeHooks;
              if (routeHooks && routeHooks[key]) {
                  if (routeHooks[key].pre) {
                      pres = Array.isArray(routeHooks[key].pre) ? routeHooks[key].pre : [routeHooks[key].pre];
                  }
                  if (routeHooks[key].post) {
                      posts = Array.isArray(routeHooks[key].post) ? routeHooks[key].post : [routeHooks[key].post];
                  }
              }
          }
          // 添加全局hook：全局hook最先被执行
          const globalHooks = opts.globalRouteHooks || {};
          if (globalHooks[key]) {
              const globalPres = globalHooks[key].pre;
              const globalPosts = globalHooks[key].post;
              if (typeof globalPres === 'function') {
                  pres = Array.isArray(pres) ? pres : [];
                  pres.unshift(globalPres);
              } else if (Array.isArray(globalPres) && globalPres.length > 0) {
                  pres = Array.isArray(pres) ? pres : [];
                  pres = globalPres.concat(pres);
              }
              if (typeof globalPosts === 'function') {
                  posts = Array.isArray(posts) ? posts : [];
                  posts.unshift(globalPosts);
              } else if (Array.isArray(globalPosts) && globalPosts.length > 0) {
                  posts = Array.isArray(posts) ? posts : [];
                  posts = globalPosts.concat(posts);
              }
          }
      }
      return { pres, posts };
  }
docs: 从源数据中解析出hooks
  @param {Object} obj - 单个元数据对象
  @param {string} key
  @param {Object} opts