UNPKG

huge-tree

Version:

vue组件,海量数据 tree、list,支持20w+,虚拟滚动<br>

21 lines (17 loc) 503 B
const route = require('koa-route'); const glob = require('glob'); // 装载路由及对应的处理器 const childRoutes = []; const files = glob.sync(`${__dirname}/modules/**/routes.js`); files.forEach(f => { let routes = require(f); let newRoutes = routes.map(i => { return route[i.method](i.path, i.handler); }); childRoutes.push(...newRoutes); }); const main = ctx => { ctx.response.body = 'Hello World'; }; const arr = [route.get('/', main), ...childRoutes]; module.exports = arr;