We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
首先分析vue-router解决的问题:用户点击跳转链接内容切换,页面不刷新。朝着这个方向思考,手写vue-router路由的思路如下:
createRouter如何创建实例: https://github1s.com/vuejs/router/blob/HEAD/src/router.ts#L355-L356 history模式,事件监听: https://github1s.com/vuejs/router/blob/HEAD/src/history/html5.ts#L57 hash模式,事件监听: https://github1s.com/vuejs/router/blob/HEAD/src/history/hash.ts#L31 页面跳转routerLink: https://github1s.com/vuejs/router/blob/HEAD/src/RouterLink.ts#L184-L185 内容显示routerView: https://github1s.com/vuejs/router/blob/HEAD/src/RouterView.ts#L43-L44
The text was updated successfully, but these errors were encountered:
No branches or pull requests
实现思路
首先分析vue-router解决的问题:用户点击跳转链接内容切换,页面不刷新。朝着这个方向思考,手写vue-router路由的思路如下:
具体实现
源码实现
createRouter如何创建实例:
https://github1s.com/vuejs/router/blob/HEAD/src/router.ts#L355-L356
history模式,事件监听:
https://github1s.com/vuejs/router/blob/HEAD/src/history/html5.ts#L57
hash模式,事件监听:
https://github1s.com/vuejs/router/blob/HEAD/src/history/hash.ts#L31
页面跳转routerLink:
https://github1s.com/vuejs/router/blob/HEAD/src/RouterLink.ts#L184-L185
内容显示routerView:
https://github1s.com/vuejs/router/blob/HEAD/src/RouterView.ts#L43-L44
The text was updated successfully, but these errors were encountered: