前言
前端路由,大家都使用过,那么有没有想过它是怎么实现的吗?如:Vue-Router 或者 React-Router。或许有个大概印象,但是真正要自己去实现还是没有什么思路,那么这篇文章将完整的实现思路去实现一次。
手写难度:⭐️⭐️⭐️
涉及知识点:
- history api 和监听事件
- onhashchange 监听事件
- Web Component 自定义组件
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia-plus根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true
Java出身,喜欢前端进行转岗,主攻全栈发展,技术有:Vue、React、Nodejs、Java等。
加我好友,多个朋友交流也不错~