vue-router 的原理

1. hash

修改的时候:history.pushState('名字', null, '/xxx') || location.hash = '/xxx'

回退的时候:window.addEventListener('statepop' || 'hashchange')

2. history

修改的时候:history.pushState('名字', null, '/xxx')

回退的时候:window.addEventListener('statepop')

原文地址:https://www.cnblogs.com/amiezhang/p/11570259.html