企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] * * * * * # 1 InfernoDOM模块包 ## .1 包目录 ~~~ packages/inferno-router src/ ;组件源代码入口 inferno-router.js ;组件入口 package.json ;组件配置 README.md ;组件说明 ~~~ ## .2 包文件 ~~~ packages/inferno-router/src/index.js ;导入模块接口 import Route from '../../../src/router/Route'; import Router from '../../../src/router/Router'; import Link from '../../../src/router/Link'; import browserHistory from '../../../src/router/browserHistory'; ;导出模块接口 export default { Route, Router, Link, browserHistory }; ~~~ # 2 InfernoDOM模块源代码 ## .1 源代码的目录 ~~~ src/router/ __tests__ browseHistory.js Link.js Route.js Router.js utils.js ~~~ ## .2 源代码文件 ### 1 Route.js ~~~ ;导入接口 import { createVNode } from '../core/createBlueprint'; import Component from '../component'; ;导出Route接口 export default class Route extends Component {} ~~~ ### 2 Router.js ~~~ ;导入接口 import Component from '../component'; import { isArray } from '../core/utils'; import { exec, convertToHashbang, pathRankSort } from './utils'; import { createVNode } from '../core/createBlueprint'; ;导出Router接口 export default class Router extends Component {} ~~~ ### 3 Link.js ~~~ ;导入接口 import { createVNode } from '../core/createBlueprint'; import { convertToHashbang } from './utils'; ;导出接口 export default function Link({ to, children }, { hashbang, history }){} ~~~ ### 4 browserHistory.js ~~~ ;导出接口 export default { addRouter(router) { routers.push(router); }, removeRouter(router) { roouters.splice(routers.indexOf(router), 1); }, getCurrentUrl, getHashbangRoot }; ~~~ # 3 InfernoDOM模块接口