ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的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模块接口